Skip to content

Commit 5aa26e9

Browse files
committed
feat:add oliviajames lesson 16 hw (incopmplete)
1 parent dbd5296 commit 5aa26e9

File tree

3 files changed

+152
-0
lines changed

3 files changed

+152
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package com.codedifferently.lesson16.oliviajames;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class MakeupRoutine {
7+
public enum MakeupLook {
8+
DEWY,
9+
NATURAL,
10+
FULL_GLAM,
11+
SOFT_GLAM,
12+
}
13+
14+
// Member Variables
15+
private String name;
16+
private int durationMinutes;
17+
private boolean usesPrimer;
18+
private ArrayList<String> steps;
19+
private MakeupLook lookType;
20+
21+
// Constructor
22+
public MakeupRoutine(String name, int durationMinutes, boolean usesPrimer, MakeupLook lookType) {
23+
this.name = name;
24+
this.durationMinutes = durationMinutes;
25+
this.usesPrimer = usesPrimer;
26+
this.lookType = lookType;
27+
}
28+
29+
// Function using condition
30+
public String checkPrimerStep() {
31+
return usesPrimer ? "Primer included in routine." : "No primer used in this routine.";
32+
}
33+
34+
// Function using collection
35+
public void addStep(String step) {
36+
steps.add(step);
37+
}
38+
39+
// Function using loop
40+
public void printRoutineSteps() {
41+
for (String step : steps) {
42+
System.out.println(step);
43+
}
44+
}
45+
46+
// Function using custom exception
47+
public void validateSteps() throws StepMissingException {
48+
if (steps == null || steps.isEmpty()) {
49+
throw new StepMissingException("No steps in this makeup routine!");
50+
}
51+
}
52+
53+
// Getters for testing
54+
55+
56+
57+
public String getName() {
58+
return name;
59+
}
60+
public int getDurationMinutes() {
61+
return durationMinutes;
62+
}
63+
64+
public boolean isUsesPrimer() {
65+
return usesPrimer;
66+
}
67+
public ArrayList<String> getSteps() {
68+
return steps;
69+
}
70+
public MakeupLook getLookType() {
71+
return lookType;
72+
}
73+
74+
75+
76+
77+
//make class
78+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.codedifferently.lesson16.oliviajames;
2+
3+
public class StepMissingException extends Exception{
4+
public StepMissingException(String message) {
5+
super(message);
6+
7+
}
8+
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.codedifferently.lesson16;
2+
3+
4+
import org.junit.jupiter.api.Test;
5+
6+
public class MakeupRoutineTest{
7+
8+
MakeupRoutine makeupRoutine;
9+
10+
@BeforeEach
11+
void setUp() {
12+
makeupRoutine = new MakeupRoutine("NARS", 60, true, "DEWY")
13+
}
14+
15+
@Test
16+
void testgetName() {
17+
String actual = makeupRoutine.getName();
18+
19+
assertThat(actual).isEqualTo("NARS");
20+
}
21+
22+
23+
24+
25+
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);
31+
}
32+
33+
@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);
40+
}
41+
42+
@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);
49+
}
50+
51+
@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");
60+
61+
} else {
62+
System.out.println("Step add mascara is not in the list");
63+
}
64+
}*/
65+
}

0 commit comments

Comments
 (0)