質問編集履歴

3

2018/08/15 23:19

投稿

RyoKawamata
RyoKawamata

スコア19

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
- public boolean isPeriodCovered() {
25
+ public static boolean isPeriodCovered() {
26
26
 
27
27
  LocalDateTime now = LocalDateTime.now();
28
28
 
@@ -54,11 +54,11 @@
54
54
 
55
55
 
56
56
 
57
- DemoClass demoClass = new DemoClass();
57
+
58
58
 
59
59
 
60
60
 
61
- assertFalse(demoClass.isPeriodCovered());
61
+ assertFalse(DemoClass.isPeriodCovered());
62
62
 
63
63
  }
64
64
 
@@ -76,7 +76,7 @@
76
76
 
77
77
 
78
78
 
79
- assertTrue(demoClass.isPeriodCovered());
79
+ assertTrue(DetroitemoClass.isPeriodCovered());
80
80
 
81
81
  }
82
82
 

2

typo修正

2018/08/15 23:18

投稿

RyoKawamata
RyoKawamata

スコア19

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  @Test
48
48
 
49
- public void 対象期間外はfalseを返すか {
49
+ public void 対象期間外はfalseを返すか() {
50
50
 
51
51
  // この時間をテストしたい
52
52
 
@@ -64,7 +64,7 @@
64
64
 
65
65
 
66
66
 
67
- public void 対象機関内ならtrueを返すか {
67
+ public void 対象期間内ならtrueを返すか() {
68
68
 
69
69
  // この時間をテストしたい
70
70
 

1

説明を追加

2018/08/15 13:38

投稿

RyoKawamata
RyoKawamata

スコア19

test CHANGED
File without changes
test CHANGED
@@ -16,13 +16,13 @@
16
16
 
17
17
  public DemoClass {
18
18
 
19
- public static final LocalDateTime startDay = LocalDateTime.of(2018,8,20,0,0);
19
+ public static final LocalDateTime START_DAY = LocalDateTime.of(2018,8,20,0,0);
20
20
 
21
- public static final LocalDateTime endDay = LocalDateTime.of(2018,8,30,0,0);
21
+ public static final LocalDateTime END_DAY = LocalDateTime.of(2018,8,30,0,0);
22
22
 
23
23
 
24
24
 
25
- public boolean isPeriodCovered() {
25
+ public boolean isPeriodCovered() {
26
26
 
27
27
  LocalDateTime now = LocalDateTime.now();
28
28
 
@@ -31,6 +31,56 @@
31
31
  }
32
32
 
33
33
  }
34
+
35
+ ```
36
+
37
+
38
+
39
+ ### テストしたいこと
40
+
41
+
42
+
43
+ ```java
44
+
45
+
46
+
47
+ @Test
48
+
49
+ public void 対象期間外はfalseを返すか {
50
+
51
+ // この時間をテストしたい
52
+
53
+ LocalDateTime OutsidePriodDay = DemoClass.STARTDAY.minusSeconds(1);
54
+
55
+
56
+
57
+ DemoClass demoClass = new DemoClass();
58
+
59
+
60
+
61
+ assertFalse(demoClass.isPeriodCovered());
62
+
63
+ }
64
+
65
+
66
+
67
+ public void 対象機関内ならtrueを返すか {
68
+
69
+ // この時間をテストしたい
70
+
71
+ LocalDateTime OutsidePriodDay = DemoClass.STARTDAY.plusSeconds(1);
72
+
73
+
74
+
75
+ DemoClass demoClass = new DemoClass();
76
+
77
+
78
+
79
+ assertTrue(demoClass.isPeriodCovered());
80
+
81
+ }
82
+
83
+
34
84
 
35
85
  ```
36
86