Przeglądaj źródła

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

gigasecond: standardize starter implementation
FridaTveit 9 lat temu
rodzic
commit
6b268e2bec

+ 7
- 6
exercises/gigasecond/src/example/java/Gigasecond.java Wyświetl plik

@@ -1,19 +1,20 @@
1 1
 import java.time.LocalDateTime;
2 2
 import java.time.LocalDate;
3 3
 
4
-public class Gigasecond {
4
+class Gigasecond {
5 5
 
6 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 17
         return birthDateTime.plusSeconds(1000000000);
18 18
     }
19
+
19 20
 }

+ 0
- 0
exercises/gigasecond/src/main/java/.keep Wyświetl plik


+ 18
- 0
exercises/gigasecond/src/main/java/Gigasecond.java Wyświetl plik

@@ -0,0 +1,18 @@
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 Wyświetl plik

@@ -9,7 +9,6 @@ import static org.junit.Assert.assertEquals;
9 9
 
10 10
 public class GigasecondTest {
11 11
 
12
-
13 12
     @Test
14 13
     public void modernTime() {
15 14
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(2011, Month.APRIL, 25));