Parcourir la source

Merge pull request #560 from exercism/538-gigasecond-starter

gigasecond: standardize starter implementation
FridaTveit il y a 9 ans
Parent
révision
6b268e2bec

+ 7
- 6
exercises/gigasecond/src/example/java/Gigasecond.java Voir le fichier

1
 import java.time.LocalDateTime;
1
 import java.time.LocalDateTime;
2
 import java.time.LocalDate;
2
 import java.time.LocalDate;
3
 
3
 
4
-public class Gigasecond {
4
+class Gigasecond {
5
 
5
 
6
     private LocalDateTime birthDateTime;
6
     private LocalDateTime birthDateTime;
7
 
7
 
8
-    public Gigasecond(LocalDateTime birthDateTime) {
9
-        this.birthDateTime = birthDateTime;
8
+    Gigasecond(LocalDate birthDate) {
9
+        this.birthDateTime = birthDate.atTime(0, 0);
10
     }
10
     }
11
 
11
 
12
-    public Gigasecond(LocalDate birthDate) {
13
-        this.birthDateTime = birthDate.atTime(0, 0);
12
+    Gigasecond(LocalDateTime birthDateTime) {
13
+        this.birthDateTime = birthDateTime;
14
     }
14
     }
15
 
15
 
16
-    public LocalDateTime getDate() {
16
+    LocalDateTime getDate() {
17
         return birthDateTime.plusSeconds(1000000000);
17
         return birthDateTime.plusSeconds(1000000000);
18
     }
18
     }
19
+
19
 }
20
 }

+ 0
- 0
exercises/gigasecond/src/main/java/.keep Voir le fichier


+ 18
- 0
exercises/gigasecond/src/main/java/Gigasecond.java Voir le fichier

1
+import java.time.LocalDate;
2
+import java.time.LocalDateTime;
3
+
4
+class Gigasecond {
5
+
6
+    Gigasecond(LocalDate birthDate) {
7
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
8
+    }
9
+
10
+    Gigasecond(LocalDateTime birthDateTime) {
11
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
12
+    }
13
+
14
+    LocalDateTime getDate() {
15
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
16
+    }
17
+
18
+}

+ 0
- 1
exercises/gigasecond/src/test/java/GigasecondTest.java Voir le fichier

9
 
9
 
10
 public class GigasecondTest {
10
 public class GigasecondTest {
11
 
11
 
12
-
13
     @Test
12
     @Test
14
     public void modernTime() {
13
     public void modernTime() {
15
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(2011, Month.APRIL, 25));
14
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(2011, Month.APRIL, 25));