Skip to content

Commit

Permalink
Re-added GoalTests.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Youssef committed Dec 6, 2022
1 parent 5f658db commit cd3a7b4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions observer/GoalTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package observer;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

public class GoalTests {

@Test
public void addPointsTest() {
Goal goalA = new Goal("goalA", 50);
goalA.addPoints(30);
goalA.addPoints(5);
assertEquals("goalA: 35/50", goalA.toString());
}

@Test
public void goalCompleteTest() {
Goal goalB = new Goal("goalB", 60);
assertEquals(true, goalB.addPoints(60));
}

@Test
public void testGoalToString() {
Goal goalC = new Goal("goalC", 100);
assertEquals("goalC: 0/100", goalC.toString());
goalC.addPoints(50);
assertEquals("goalC: 50/100", goalC.toString());
goalC.addPoints(50);
assertEquals("goalC", goalC.toString());
goalC.addPoints(50);
assertEquals("goalC", goalC.toString());
}
}

0 comments on commit cd3a7b4

Please sign in to comment.