-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduceTest.java
More file actions
45 lines (35 loc) · 1.38 KB
/
ProduceTest.java
File metadata and controls
45 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class ProduceTest {
@Test
public void testProduce() {
Produce produce = new Produce("Apple", "fall");
assertEquals("Apple", produce.getName());
assertEquals("fall", produce.getSeason());
produce = new Produce("Strawberry", "winter");
assertEquals("Strawberry", produce.getName());
assertEquals("winter", produce.getSeason());
}
@Test
public void testCheckInSeason() {
Produce produce = new Produce("Apple", "fall");
assertFalse(produce.checkInSeason(produce.getSeason()));
produce = new Produce("Strawberry", "winter");
assertFalse(produce.checkInSeason(produce.getSeason()));
}
@Test
public void testGetCurrentSeason() {
Produce produce = new Produce("Apple", "fall");
assertNotEquals("fall", produce.getCurrentSeason());
produce = new Produce("Strawberry", "winter");
assertNotEquals("winter", produce.getCurrentSeason());
}
@Test
public void testCompareTo() {
Produce produce1 = new Produce("Apple", "fall");
Produce produce2 = new Produce("Banana", "summer");
Produce produce3 = new Produce("Apple", "fall");
assertTrue(produce1.compareTo(produce2) < 0);
assertEquals(0, produce1.compareTo(produce3));
}
}