-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathToasterTest.java
More file actions
45 lines (35 loc) · 1.31 KB
/
ToasterTest.java
File metadata and controls
45 lines (35 loc) · 1.31 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 models;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import static org.junit.Assert.*;
public class ToasterTest {
@Test
public void setNameTest() {
// given (1)
String expected = "OZWEEGO";
// when (2)
Toaster toasty= new Toaster();
toasty.setName(expected);
// then (3)
Assertions.assertEquals(expected, toasty.getName());
}
@Test // (1)
public void constructorTest(){
int expectedId = 6;
String expectedName = "Stan Smith";
String expectedBrand = "Adidas";
int expectedSport = 2;
int expectedQty = 10;
float expectedPrice = 80.00f;
// (3)
Toaster toasty = new Toaster(expectedId, expectedName, expectedBrand,
expectedSport, expectedQty,expectedPrice);
// (4)
Assertions.assertEquals(expectedId, toasty.getId());
Assertions.assertEquals(expectedName, toasty.getName());
Assertions.assertEquals(expectedBrand, toasty.getBrand());
Assertions.assertEquals(expectedSport, toasty.getToastSlots());
Assertions.assertEquals(expectedQty, toasty.getQty());
Assertions.assertEquals(expectedPrice, toasty.getPrice());
}
}