From fd647eadd9298e45a7f5572e770bf58387c1f12f Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 1 Nov 2024 18:00:18 +0000 Subject: [PATCH 1/6] feat: added Boxer.java to create a real world object and BoxerTest.java to test it inside of a created folder boxer for lesson_16 - JosephCaballero --- .../codedifferently/lesson16/boxer/Boxer.java | 176 ++++++++++++++++++ .../lesson16/boxer/BoxerTest.java | 73 ++++++++ 2 files changed, 249 insertions(+) create mode 100644 lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java create mode 100644 lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java diff --git a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java new file mode 100644 index 000000000..c38d14244 --- /dev/null +++ b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java @@ -0,0 +1,176 @@ +package com.codedifferently.lesson16.boxer; + +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +public class Boxer { + public enum BoxerStyle { + SWITCHHITTER, + BOXERPUNCHER, + SOUTHPAW, + INFIGHTER, + SLUGGER, + OUTFIGHTER, + ORTHODOX; + } + + public class BoxerIsRetiredException extends Exception { + public BoxerIsRetiredException(String message) { + super(message); + } + } + + public class BoxerHasNoFightsException extends Exception { + public BoxerHasNoFightsException(String message) { + super(message); + } + } + + private String name; + private HashMap fights; + private int power; + private int health; + private BoxerStyle skillSet; + private boolean ableToFight; + private BoxerStyle[] style = BoxerStyle.values(); + private static Random rand = new Random(); + + public Boxer(String name, int power, int health) { + this.name = name; + this.power = power; + this.health = health; + this.ableToFight = true; + this.skillSet = BoxerStyle.ORTHODOX; + fights = new HashMap<>(); + } + + public String getName() { + return name; + } + + public boolean getAbleToFight() { + return ableToFight; + } + + public void workout(int additional) { + power += additional; + } + + public int getPower() { + return power; + } + + public HashMap getFightHistory() { + return fights; + } + + public int getHealth() { + return health; + } + + public void rest() { + health += 1; + } + + public void rollSkillSet() { + int randomIndex = rand.nextInt(style.length); + BoxerStyle newStyle = style[randomIndex]; + skillSet = newStyle; + System.out.println("Random style: " + skillSet); + } + + public void addFights(String name, char d) throws BoxerIsRetiredException { + if (ableToFight == false) { + throw new BoxerIsRetiredException("Boxer is retired"); + } + fights.put(name, d); + } + + public void retire() throws BoxerIsRetiredException { + checkRetirementStatus(); + ableToFight = false; + } + + private void checkRetirementStatus() throws BoxerIsRetiredException { + if (ableToFight == false) { + throw new BoxerIsRetiredException("Boxer is already retired"); + } + } + + private void checkBoxerHasntFoughtAnyone() throws BoxerHasNoFightsException { + if (fights.isEmpty()) { + throw new BoxerHasNoFightsException("Boxer hasnt fought anyone"); + } + } + + public String getFights() throws BoxerHasNoFightsException { + checkBoxerHasntFoughtAnyone(); + String fightsHad = ""; + for (Map.Entry entry : fights.entrySet()) { + String key = entry.getKey(); + char value = entry.getValue(); + fightsHad += "You fought " + key + " " + value; + } + return fightsHad; + } + + public void bout(Boxer boxer) throws BoxerIsRetiredException { + if (ableToFight == false) { + throw new BoxerIsRetiredException("Boxer is retired"); + } + String boxerName = boxer.getName(); + if (power < boxer.getPower()) { + ableToFight = false; + fights.put(boxerName, 'L'); + } else if (power == boxer.getPower()) { + fights.put(boxerName, 'D'); + } else { + fights.put(boxerName, 'W'); + } + } + + public void setName(String name) { + this.name = name; + } + + public void setFights(HashMap fights) { + this.fights = fights; + } + + public void setPower(int power) { + this.power = power; + } + + public void setHealth(int health) { + this.health = health; + } + + public BoxerStyle getSkillSet() { + return skillSet; + } + + public void setSkillSet(BoxerStyle skillSet) { + this.skillSet = skillSet; + } + + public void setAbleToFight(boolean ableToFight) { + this.ableToFight = ableToFight; + } + + public BoxerStyle[] getStyle() { + return style; + } + + public void setStyle(BoxerStyle[] style) { + this.style = style; + } + + public static Random getRand() { + return rand; + } + + public static void setRand(Random rand) { + Boxer.rand = rand; + } +} diff --git a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java new file mode 100644 index 000000000..253f0d8e7 --- /dev/null +++ b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java @@ -0,0 +1,73 @@ +package com.codedifferently.lesson16.boxer; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import com.codedifferently.lesson16.boxer.Boxer.BoxerHasNoFightsException; +import com.codedifferently.lesson16.boxer.Boxer.BoxerIsRetiredException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class BoxerTest { + + Boxer boxer; + + @BeforeEach + void setUp() { + boxer = new Boxer("Joseph", 100, 100); + } + + @Test + void testWorkout() { + boxer.workout(10); + assertEquals(110, boxer.getPower()); + } + + @Test + void testRest() { + int previousHealth = boxer.getHealth(); + boxer.rest(); + assertNotEquals(boxer.getHealth(), previousHealth); + } + + @Test + void testGetHealth() { + assertEquals(100, boxer.getHealth()); + } + + @Test + void testGetFightHistory() throws BoxerHasNoFightsException, BoxerIsRetiredException { + Boxer mike = new Boxer("mike", 1000, 1000); + boxer.bout(mike); + assertEquals("You fought " + mike.getName() + " L", boxer.getFights()); + } + + @Test + void testIsAbleToFight_boxerIsNotRetiredOrInjured() { + assertEquals(true, boxer.getAbleToFight()); + } + + @Test + void testIsAbleToFight_boxerIsNotAbleToFight() throws BoxerIsRetiredException { + boxer.retire(); + assertEquals(false, boxer.getAbleToFight()); + } + + @Test + void testBout_makingNewBoxerToFightAnother() throws BoxerIsRetiredException { + Boxer mike = new Boxer("Mike", 1000, 1000); + boxer.bout(mike); + assertEquals(false, boxer.getAbleToFight()); + } + + @Test + void testGetFightHistory_noFights() { + assertEquals(boxer.getHealth(), 100); + } + + @Test + void testRollSkillSet() { + boxer.rollSkillSet(); + assertNotEquals(boxer.getStyle(), "BASIC"); + } +} From 310ef0701a5006b71e37fd70b20a6e6227c3ad7c Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 1 Nov 2024 19:34:06 +0000 Subject: [PATCH 2/6] feat: modified tests more in BoxerTest.java and modified code in Boxer.java. lesson_16 -JosephCaballero --- .../codedifferently/lesson16/boxer/Boxer.java | 33 ----- .../lesson16/boxer/BoxerTest.java | 114 +++++++++++++++--- 2 files changed, 96 insertions(+), 51 deletions(-) diff --git a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java index c38d14244..fd52b3cc8 100644 --- a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java +++ b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java @@ -61,10 +61,6 @@ public int getPower() { return power; } - public HashMap getFightHistory() { - return fights; - } - public int getHealth() { return health; } @@ -133,15 +129,6 @@ public void bout(Boxer boxer) throws BoxerIsRetiredException { public void setName(String name) { this.name = name; } - - public void setFights(HashMap fights) { - this.fights = fights; - } - - public void setPower(int power) { - this.power = power; - } - public void setHealth(int health) { this.health = health; } @@ -150,27 +137,7 @@ public BoxerStyle getSkillSet() { return skillSet; } - public void setSkillSet(BoxerStyle skillSet) { - this.skillSet = skillSet; - } - public void setAbleToFight(boolean ableToFight) { this.ableToFight = ableToFight; } - - public BoxerStyle[] getStyle() { - return style; - } - - public void setStyle(BoxerStyle[] style) { - this.style = style; - } - - public static Random getRand() { - return rand; - } - - public static void setRand(Random rand) { - Boxer.rand = rand; - } } diff --git a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java index 253f0d8e7..f1b6d1dc3 100644 --- a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java +++ b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java @@ -1,12 +1,14 @@ package com.codedifferently.lesson16.boxer; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import com.codedifferently.lesson16.boxer.Boxer.BoxerHasNoFightsException; import com.codedifferently.lesson16.boxer.Boxer.BoxerIsRetiredException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; public class BoxerTest { @@ -14,29 +16,23 @@ public class BoxerTest { @BeforeEach void setUp() { - boxer = new Boxer("Joseph", 100, 100); + boxer = new Boxer("Joseph", 99, 99); } @Test - void testWorkout() { + void testWorkout_addingTenPointsOfPower() { boxer.workout(10); - assertEquals(110, boxer.getPower()); + assertEquals(109, boxer.getPower()); } @Test - void testRest() { + void testRest_restingToIncreaseHealth() { int previousHealth = boxer.getHealth(); boxer.rest(); assertNotEquals(boxer.getHealth(), previousHealth); } - @Test - void testGetHealth() { - assertEquals(100, boxer.getHealth()); - } - - @Test - void testGetFightHistory() throws BoxerHasNoFightsException, BoxerIsRetiredException { + void testGetFightHistory_makingAFighterToHaveABout() throws BoxerHasNoFightsException, BoxerIsRetiredException { Boxer mike = new Boxer("mike", 1000, 1000); boxer.bout(mike); assertEquals("You fought " + mike.getName() + " L", boxer.getFights()); @@ -54,20 +50,102 @@ void testIsAbleToFight_boxerIsNotAbleToFight() throws BoxerIsRetiredException { } @Test - void testBout_makingNewBoxerToFightAnother() throws BoxerIsRetiredException { + void testBout_makingNewBoxerToFightAnotherAndSeeTheResults() throws BoxerIsRetiredException { Boxer mike = new Boxer("Mike", 1000, 1000); boxer.bout(mike); assertEquals(false, boxer.getAbleToFight()); } @Test - void testGetFightHistory_noFights() { - assertEquals(boxer.getHealth(), 100); + void testBout_makingNewBoxerToFightAndDraw() throws BoxerIsRetiredException, BoxerHasNoFightsException { + Boxer ryan = new Boxer("Ryan Garcia", 99, 99); + boxer.bout(ryan); + assertEquals(boxer.getFights(), "You fought Ryan Garcia D"); + } + + @Test + void testBout_makingNewBoxerToWinAgainstWithBoxer() throws BoxerIsRetiredException, BoxerHasNoFightsException { + Boxer hitman = new Boxer("Thomas Hearns", 98, 98); + boxer.bout(hitman); + assertEquals(boxer.getFights(), "You fought " + hitman.getName() + " W"); + } + + @Test + void testGetHealth() { + assertEquals(boxer.getHealth(), 99); } @Test - void testRollSkillSet() { + void testRollSkillSet_testingBasicIsNotWhatIsRolled() { boxer.rollSkillSet(); - assertNotEquals(boxer.getStyle(), "BASIC"); + assertNotEquals(boxer.getSkillSet(), "BASIC"); + } + + @Test + void testAddFights() throws BoxerIsRetiredException, BoxerHasNoFightsException { + boxer.addFights("Marvin Hagler", 'L'); + assertEquals(boxer.getFights(), "You fought Marvin Hagler L"); + } + + @Test + void testAddFights_whenRetired() throws BoxerIsRetiredException { + boxer.retire(); + assertThatThrownBy( + () -> { + boxer.addFights("lomachenko", 'W'); + }) + .isInstanceOf(BoxerIsRetiredException.class) + .hasMessage("Boxer is retired"); + } + + @Test + void testRetire_whenRetired() throws BoxerIsRetiredException { + boxer.retire(); + assertThatThrownBy( + () -> { + boxer.retire(); + }) + .isInstanceOf(BoxerIsRetiredException.class) + .hasMessage("Boxer is already retired"); + } + + @Test + void testSetName() { + boxer.setName("Pablo"); + assertEquals(boxer.getName(), "Pablo"); + } + + @Test + void testSetAbleToFight() { + boxer.setAbleToFight(false); + assertFalse(boxer.getAbleToFight()); + } + + @Test + void testSetHealth() { + boxer.setHealth(2); + assertEquals(boxer.getHealth(), 2); + } + + @Test + void testBoxerIsRetiredException_retiringBoxerThenThrowingException() throws BoxerIsRetiredException { + Boxer leaonard = new Boxer("Sugar ray", 200, 200); + boxer.retire(); + assertThatThrownBy( + () -> { + boxer.bout(leaonard); + }) + .isInstanceOf(BoxerIsRetiredException.class) + .hasMessageContaining("Boxer is retired"); + } + + @Test + void testBoxerHasNoFightsException_gettingFightsWhenNoFightsHaveBeenHad() { + assertThatThrownBy( + () -> { + boxer.getFights(); + }) + .isInstanceOf(BoxerHasNoFightsException.class) + .hasMessageContaining("Boxer hasnt fought anyone"); } } From 88edd33972faed8cf211ea05a7fb90e98f8449a9 Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 1 Nov 2024 19:41:19 +0000 Subject: [PATCH 3/6] fix: adds spotlessApply. lesson_16 -JosephCaballero --- .../codedifferently/lesson16/boxer/Boxer.java | 1 + .../lesson16/boxer/BoxerTest.java | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java index fd52b3cc8..67972c71b 100644 --- a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java +++ b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java @@ -129,6 +129,7 @@ public void bout(Boxer boxer) throws BoxerIsRetiredException { public void setName(String name) { this.name = name; } + public void setHealth(int health) { this.health = health; } diff --git a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java index f1b6d1dc3..bea3569a8 100644 --- a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java +++ b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java @@ -4,11 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import com.codedifferently.lesson16.boxer.Boxer.BoxerHasNoFightsException; import com.codedifferently.lesson16.boxer.Boxer.BoxerIsRetiredException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class BoxerTest { @@ -31,8 +31,10 @@ void testRest_restingToIncreaseHealth() { boxer.rest(); assertNotEquals(boxer.getHealth(), previousHealth); } + @Test - void testGetFightHistory_makingAFighterToHaveABout() throws BoxerHasNoFightsException, BoxerIsRetiredException { + void testGetFightHistory_makingAFighterToHaveABout() + throws BoxerHasNoFightsException, BoxerIsRetiredException { Boxer mike = new Boxer("mike", 1000, 1000); boxer.bout(mike); assertEquals("You fought " + mike.getName() + " L", boxer.getFights()); @@ -57,14 +59,16 @@ void testBout_makingNewBoxerToFightAnotherAndSeeTheResults() throws BoxerIsRetir } @Test - void testBout_makingNewBoxerToFightAndDraw() throws BoxerIsRetiredException, BoxerHasNoFightsException { + void testBout_makingNewBoxerToFightAndDraw() + throws BoxerIsRetiredException, BoxerHasNoFightsException { Boxer ryan = new Boxer("Ryan Garcia", 99, 99); boxer.bout(ryan); assertEquals(boxer.getFights(), "You fought Ryan Garcia D"); } @Test - void testBout_makingNewBoxerToWinAgainstWithBoxer() throws BoxerIsRetiredException, BoxerHasNoFightsException { + void testBout_makingNewBoxerToWinAgainstWithBoxer() + throws BoxerIsRetiredException, BoxerHasNoFightsException { Boxer hitman = new Boxer("Thomas Hearns", 98, 98); boxer.bout(hitman); assertEquals(boxer.getFights(), "You fought " + hitman.getName() + " W"); @@ -128,7 +132,8 @@ void testSetHealth() { } @Test - void testBoxerIsRetiredException_retiringBoxerThenThrowingException() throws BoxerIsRetiredException { + void testBoxerIsRetiredException_retiringBoxerThenThrowingException() + throws BoxerIsRetiredException { Boxer leaonard = new Boxer("Sugar ray", 200, 200); boxer.retire(); assertThatThrownBy( From 76f0c6cdc2d754173c0d4dd25c9ad7e8abf3f8ff Mon Sep 17 00:00:00 2001 From: Joseph Date: Sun, 3 Nov 2024 01:10:01 +0000 Subject: [PATCH 4/6] chore:fixing basic spacing to ensure usability. lesson_16 - JosephCaballero --- .../src/main/java/com/codedifferently/lesson16/boxer/Boxer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java index 67972c71b..8c4d29634 100644 --- a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java +++ b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java @@ -106,7 +106,7 @@ public String getFights() throws BoxerHasNoFightsException { for (Map.Entry entry : fights.entrySet()) { String key = entry.getKey(); char value = entry.getValue(); - fightsHad += "You fought " + key + " " + value; + fightsHad += "You fought " + key + " " + value +"\n"; } return fightsHad; } From 2d7173505a9c9cc77756660f40e55f92d960fbd5 Mon Sep 17 00:00:00 2001 From: Joseph Date: Sun, 3 Nov 2024 01:16:26 +0000 Subject: [PATCH 5/6] chore: applied spotlessApply and adadjusted tests. lesson_16 -JosephCaballero --- .../java/com/codedifferently/lesson16/boxer/Boxer.java | 2 +- .../com/codedifferently/lesson16/boxer/BoxerTest.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java index 8c4d29634..e71b18b0a 100644 --- a/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java +++ b/lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/boxer/Boxer.java @@ -106,7 +106,7 @@ public String getFights() throws BoxerHasNoFightsException { for (Map.Entry entry : fights.entrySet()) { String key = entry.getKey(); char value = entry.getValue(); - fightsHad += "You fought " + key + " " + value +"\n"; + fightsHad += "fought: " + key + " " + value + "."; } return fightsHad; } diff --git a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java index bea3569a8..26ce8eaf6 100644 --- a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java +++ b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java @@ -37,7 +37,7 @@ void testGetFightHistory_makingAFighterToHaveABout() throws BoxerHasNoFightsException, BoxerIsRetiredException { Boxer mike = new Boxer("mike", 1000, 1000); boxer.bout(mike); - assertEquals("You fought " + mike.getName() + " L", boxer.getFights()); + assertEquals("fought: " + mike.getName() + " L.", boxer.getFights()); } @Test @@ -63,7 +63,7 @@ void testBout_makingNewBoxerToFightAndDraw() throws BoxerIsRetiredException, BoxerHasNoFightsException { Boxer ryan = new Boxer("Ryan Garcia", 99, 99); boxer.bout(ryan); - assertEquals(boxer.getFights(), "You fought Ryan Garcia D"); + assertEquals(boxer.getFights(), "fought: Ryan Garcia D."); } @Test @@ -71,7 +71,7 @@ void testBout_makingNewBoxerToWinAgainstWithBoxer() throws BoxerIsRetiredException, BoxerHasNoFightsException { Boxer hitman = new Boxer("Thomas Hearns", 98, 98); boxer.bout(hitman); - assertEquals(boxer.getFights(), "You fought " + hitman.getName() + " W"); + assertEquals(boxer.getFights(), "fought: " + hitman.getName() + " W."); } @Test @@ -88,7 +88,7 @@ void testRollSkillSet_testingBasicIsNotWhatIsRolled() { @Test void testAddFights() throws BoxerIsRetiredException, BoxerHasNoFightsException { boxer.addFights("Marvin Hagler", 'L'); - assertEquals(boxer.getFights(), "You fought Marvin Hagler L"); + assertEquals(boxer.getFights(), "fought: Marvin Hagler L."); } @Test From d44f561bff35ccfc2c52f80304fecea14f6b83f1 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 21 Nov 2024 22:56:13 +0000 Subject: [PATCH 6/6] fix: adds an enum to check aginst another enum. lesson_16 -JosephCaballero --- .../java/com/codedifferently/lesson16/boxer/BoxerTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java index 26ce8eaf6..2fe3b169e 100644 --- a/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java +++ b/lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/boxer/BoxerTest.java @@ -11,6 +11,9 @@ import org.junit.jupiter.api.Test; public class BoxerTest { + public enum testStyle { + BASIC + } Boxer boxer; @@ -82,7 +85,7 @@ void testGetHealth() { @Test void testRollSkillSet_testingBasicIsNotWhatIsRolled() { boxer.rollSkillSet(); - assertNotEquals(boxer.getSkillSet(), "BASIC"); + assertNotEquals(boxer.getSkillSet(), testStyle.BASIC); } @Test