Skip to content

Commit

Permalink
[cleanup] Minor improvement to a Unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
meronbrouwer committed Jun 21, 2024
1 parent 1637bd9 commit 6a1ad76
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ void setDirectionRIGHTForSpeedOneCreatesRightVectorTest() {
@Test
void setDirectionToUPForSpeedOneCreatesUpVectorTest() {
// Arrange
sut.setSpeed(1);
sut.setSpeed(2);

// Act
sut.setDirection(Direction.UP);

// Assert
assertEquals(0, sut.get().getX(), DELTA);
assertEquals(-1, sut.get().getY(), DELTA);
assertEquals(-2, sut.get().getY(), DELTA);
}

@Test
Expand Down Expand Up @@ -329,14 +329,14 @@ void resetSpeedAfterSpeedHasBeenSetToZeroCreatesCorrectVectorTest() {
@Test
void getDirectionForDirectionBelow180TestReturnsCorrectValue() {
// Arrange
final double DIRECTION = 42;
sut.setMotion(1, DIRECTION);
final double expected = 42;
sut.setMotion(1, expected);

// Act
var direction = sut.getDirection();
var actual = sut.getDirection();

// Assert
assertEquals(DIRECTION, direction, DELTA);
assertEquals(expected, actual, DELTA);
}

@Test
Expand Down Expand Up @@ -366,14 +366,14 @@ void getDirectionsReturnsNumericValueWhenEnumIsForDirectionWasUsedInMotionTest()
@Test
void getDirectionForDirectionAbove180ReturnsCorrectValueTest() {
// Arrange
final double DIRECTION = 189;
sut.setMotion(1, DIRECTION);
final double expected = 189;
sut.setMotion(1, expected);

// Act
var direction = sut.getDirection();
var actual = sut.getDirection();

// Assert
assertEquals(DIRECTION, direction, DELTA);
assertEquals(expected, actual, DELTA);
}

@Test
Expand All @@ -392,7 +392,7 @@ void getDirectionAfterSpeedSetTo0ReturnsCorrectDirection(){
@Test
void changeDirectionWithZeroDoesNotChangeAngleTest() {
// Arrange
sut.setMotion(1, Direction.DOWN.getValue());
sut.setMotion(2, Direction.DOWN.getValue());

// Act
sut.changeDirection(0);
Expand Down

0 comments on commit 6a1ad76

Please sign in to comment.