|
1 |
| -package com.codedifferently.lesson16; |
| 1 | +package com.codedifferently.lesson16.oliviajames; |
2 | 2 |
|
| 3 | +import static org.assertj.core.api.Assertions.assertThat; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 7 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
3 | 8 |
|
| 9 | +import com.codedifferently.lesson16.oliviajames.MakeupRoutine.MakeupLook; |
| 10 | +import org.junit.jupiter.api.BeforeEach; |
4 | 11 | import org.junit.jupiter.api.Test;
|
5 | 12 |
|
6 |
| -public class MakeupRoutineTest{ |
| 13 | +public class MakeupRoutineTest { |
7 | 14 |
|
8 |
| -MakeupRoutine makeupRoutine; |
| 15 | + MakeupRoutine makeupRoutine; |
9 | 16 |
|
10 |
| -@BeforeEach |
11 |
| -void setUp() { |
12 |
| -makeupRoutine = new MakeupRoutine("NARS", 60, true, "DEWY") |
13 |
| -} |
| 17 | + @BeforeEach |
| 18 | + void setUp() { |
| 19 | + makeupRoutine = new MakeupRoutine("NARS", 60, true, MakeupLook.FULL_GLAM); |
| 20 | + } |
14 | 21 |
|
15 | 22 | @Test
|
16 | 23 | void testgetName() {
|
17 |
| -String actual = makeupRoutine.getName(); |
18 |
| - |
19 |
| -assertThat(actual).isEqualTo("NARS"); |
20 |
| -} |
21 |
| - |
| 24 | + String actual = makeupRoutine.getName(); |
22 | 25 |
|
| 26 | + assertThat(actual).isEqualTo("NARS"); |
| 27 | + } |
23 | 28 |
|
| 29 | + @Test |
| 30 | + public void testSetName() { |
| 31 | + makeupRoutine.setName("Night Out"); |
| 32 | + assertEquals("Night Out", makeupRoutine.getName()); |
| 33 | + } |
24 | 34 |
|
| 35 | + @Test |
| 36 | + public void testGetTime() { |
| 37 | + assertEquals(60, makeupRoutine.getTime()); |
| 38 | + } |
25 | 39 |
|
26 |
| - /*public void testGetLook() { |
27 |
| - MakeupRoutine routine = |
28 |
| - new MakeupRoutine("Soft Glam", "Foundation", 5, GlamRank.SOFT_GLAM, 120.00); |
29 |
| - GlamRank expected = GlamRank.SOFT_GLAM; |
30 |
| - assertThat(routine.getRank()).isEqualTo(expected); |
| 40 | + @Test |
| 41 | + public void testSetTime() { |
| 42 | + makeupRoutine.setTime(45); |
| 43 | + assertEquals(45, makeupRoutine.getTime()); |
31 | 44 | }
|
32 | 45 |
|
33 | 46 | @Test
|
34 |
| - public void testSetBaseProduct() { |
35 |
| - MakeupRoutine routine = |
36 |
| - new MakeupRoutine("Natural", "BB Cream", 3, GlamRank.NATURAL_BADDIE, 85.50); |
37 |
| - routine.setBaseProduct("Tinted Moisturizer"); |
38 |
| - String expected = "Tinted Moisturizer"; |
39 |
| - assertThat(routine.getBaseProduct()).isEqualTo(expected); |
| 47 | + public void testGetLookType() { |
| 48 | + assertEquals(MakeupRoutine.MakeupLook.FULL_GLAM, makeupRoutine.getLookType()); |
40 | 49 | }
|
41 | 50 |
|
42 | 51 | @Test
|
43 |
| - public void testSetTotalCost() { |
44 |
| - MakeupRoutine routine = |
45 |
| - new MakeupRoutine("Full Glam", "Full Coverage Foundation", 8, GlamRank.FULL_GLAM, 200.00); |
46 |
| - routine.setTotalCost(220.00); |
47 |
| - double expected = 220.00; |
48 |
| - assertThat(routine.getTotalCost()).isEqualTo(expected); |
| 52 | + public void testGetUsesPrimer() { |
| 53 | + try { |
| 54 | + makeupRoutine.getUsesPrimer(); |
| 55 | + } catch (MissingPrimerException e) { |
| 56 | + System.out.println(e.getMessage()); |
| 57 | + } |
49 | 58 | }
|
50 | 59 |
|
51 | 60 | @Test
|
52 |
| - public void testAddStep() { |
53 |
| - MakeupRoutine routine = |
54 |
| - new MakeupRoutine("Glow", "Light Coverage", 6, GlamRank.FULL_GLAM, 88.00); |
55 |
| - String step = "add mascara"; |
56 |
| - routine.addStep(step); |
57 |
| - steps = routine.getSteps(); |
58 |
| - if (steps.contains(step)) { |
59 |
| - System.out.println("Step add mascara is in the list"); |
| 61 | + public void testShowVanityItems() { |
| 62 | + assertNotNull(makeupRoutine); // just to check vanityItems were initialized |
| 63 | + } |
60 | 64 |
|
61 |
| - } else { |
62 |
| - System.out.println("Step add mascara is not in the list"); |
63 |
| - } |
64 |
| - }*/ |
| 65 | + @Test |
| 66 | + public void testMakeupVanityHasItems() { |
| 67 | + makeupRoutine.MakeupVanity(); |
| 68 | + assertFalse(makeupRoutine.vanityItems.isEmpty()); |
| 69 | + assertTrue(makeupRoutine.vanityItems.contains("Foundation")); |
| 70 | + } |
65 | 71 | }
|
0 commit comments