-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathCatHouseTest.java
More file actions
71 lines (64 loc) · 2.04 KB
/
CatHouseTest.java
File metadata and controls
71 lines (64 loc) · 2.04 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package rocks.zipcodewilmington;
import org.junit.Assert;
import org.junit.Test;
import rocks.zipcodewilmington.animals.Cat;
import rocks.zipcodewilmington.animals.Dog;
import rocks.zipcodewilmington.animals.animal_storage.CatHouse;
import rocks.zipcodewilmington.animals.animal_storage.DogHouse;
/**
* @author leon on 4/19/18.
*/
public class CatHouseTest {
// TODO - Create tests for `void add(Cat cat)`
// TODO - Create tests for `void remove(Integer id)`
// TODO - Create tests for `void remove(Cat cat)`
// TODO - Create tests for `Cat getCatById(Integer id)`
// TODO - Create tests for `Integer getNumberOfCats()`
@Test
public void addTest() {
CatHouse.clear();
Cat cat = new Cat(null, null, null);
CatHouse.add(cat);
Integer expected = 1;
Integer actual = CatHouse.getNumberOfCats();
Assert.assertEquals(actual, expected);
}
@Test
public void removeTestById() {
CatHouse.clear();
Cat cat = new Cat(null, null, 555);
CatHouse.add(cat);
CatHouse.remove(555);
Integer expected = 0;
Integer actual = CatHouse.getNumberOfCats();
Assert.assertEquals(actual, expected);
}
@Test
public void removeTestByCat() {
CatHouse.clear();
Cat cat = new Cat(null, null, 554);
CatHouse.add(cat);
CatHouse.remove(cat);
Integer expected = 0;
Integer actual = CatHouse.getNumberOfCats();
Assert.assertEquals(actual, expected);
}
@Test
public void getCatIdTest() {
CatHouse.clear();
Cat cat = new Cat(null, null, 54);
CatHouse.add(cat);
Cat actual = CatHouse.getCatById(54);
Assert.assertEquals(cat, actual);
}
@Test
public void getNumberOfCatsTest() {
CatHouse.clear();
Cat cat = new Cat(null, null, 51);
CatHouse.add(cat);
Integer expected = 1;
Integer actual = CatHouse.getNumberOfCats();
Assert.assertEquals(expected, actual);
}
}
// include the .clear() jawn