Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.codedifferently.lesson16.oliviajames;

import java.util.ArrayList;
import java.util.List;

public class MakeupRoutine {

public enum MakeupLook {
DEWY,
NATURAL,
FULL_GLAM,
SOFT_GLAM,
}

// Member Variables
private String name;
private int time;
private final boolean usesPrimer;
private final MakeupLook lookType;
List<String> vanityItems;

// Constructor
public MakeupRoutine(String name, int time, boolean usesPrimer, MakeupLook lookType) {
this.name = name;
this.time = time;
this.usesPrimer = true;
this.lookType = lookType;
}

// Getters/setters

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getTime() {
return time;
}

public void setTime(int time) {
this.time = time;
}

public boolean getUsesPrimer() throws MissingPrimerException {
if (!usesPrimer) {
throw new MissingPrimerException("missing primer");
}
System.out.println("has primer");
return true;
}

public MakeupLook getLookType() {
return lookType;
}

public void MakeupVanity() {
vanityItems = new ArrayList<>();
vanityItems.add("Foundation");
vanityItems.add("Concealer");
vanityItems.add("Setting Powder");
vanityItems.add("Blush");
vanityItems.add("Highlighter");
vanityItems.add("Eyeshadow Palette");
vanityItems.add("Mascara");
vanityItems.add("Eyeliner");
vanityItems.add("Lipstick");
vanityItems.add("Lip Gloss");
vanityItems.add("Setting Spray");
vanityItems.add("Makeup Brushes");
}

public void showVanityItems() {
System.out.println("Items on the vanity:");
for (String item : vanityItems) {
System.out.println("- " + item);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.codedifferently.lesson16.oliviajames;

public class MissingPrimerException extends Exception {
public MissingPrimerException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.codedifferently.lesson16.oliviajames;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.codedifferently.lesson16.oliviajames.MakeupRoutine.MakeupLook;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class MakeupRoutineTest {

MakeupRoutine makeupRoutine;

@BeforeEach
void setUp() {
makeupRoutine = new MakeupRoutine("NARS", 60, true, MakeupLook.FULL_GLAM);
}

@Test
void testgetName() {
String actual = makeupRoutine.getName();

assertThat(actual).isEqualTo("NARS");
}

@Test
public void testSetName() {
makeupRoutine.setName("Night Out");
assertEquals("Night Out", makeupRoutine.getName());
}

@Test
public void testGetTime() {
assertEquals(60, makeupRoutine.getTime());
}

@Test
public void testSetTime() {
makeupRoutine.setTime(45);
assertEquals(45, makeupRoutine.getTime());
}

@Test
public void testGetLookType() {
assertEquals(MakeupRoutine.MakeupLook.FULL_GLAM, makeupRoutine.getLookType());
}

@Test
public void testGetUsesPrimer() {
try {
makeupRoutine.getUsesPrimer();
} catch (MissingPrimerException e) {
Comment thread
anthonydmays marked this conversation as resolved.
System.out.println(e.getMessage());
}
}

@Test
public void testShowVanityItems() {
assertNotNull(makeupRoutine); // just to check vanityItems were initialized
}

@Test
public void testMakeupVanityHasItems() {
makeupRoutine.MakeupVanity();
assertFalse(makeupRoutine.vanityItems.isEmpty());
assertTrue(makeupRoutine.vanityItems.contains("Foundation"));
}
}