-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathPandaServiceTest.java
More file actions
44 lines (35 loc) · 1.34 KB
/
PandaServiceTest.java
File metadata and controls
44 lines (35 loc) · 1.34 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
package services;
import models.Pandas;
import models.Toaster;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import static org.junit.Assert.*;
public class PandaServiceTest {
@Test
public void createTest(){
// (1)
String expectedName = "Stan Smith";
String expectedBrand = "Adidas";
int expectedSport = 2;
int expectedQty = 10;
float expectedPrice = 80.00f;
// (2)
PandaService pandiService = new PandaService();
Pandas testPandi = pandiService.create(expectedName, expectedBrand,
expectedSport, expectedQty, expectedPrice);
// (3)
int actualId = testPandi.getId();
String actualName = testPandi.getName();
String actualBrand = testPandi.getSpecies();
int actualSport = testPandi.getAge();
int actualQty = testPandi.getQty();
float actualPrice = testPandi.getPrice();
// (4)
Assertions.assertEquals(Integer.class.getName(), new Integer(actualId).getClass().getName());
Assertions.assertEquals(expectedName, actualName);
Assertions.assertEquals(expectedBrand, actualBrand);
Assertions.assertEquals(expectedSport, actualSport);
Assertions.assertEquals(expectedQty, actualQty);
Assertions.assertEquals(expectedPrice, actualPrice);
}
}