Skip to content

Commit

Permalink
Added tests for equality of shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 3, 2024
1 parent c7efe1a commit 255dd46
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@

class ShapeTest {

@Test
void shapesShouldOnlyEqualWithSameRowsAndColumns() {
ShapedRecipe.Shape s1 = new ShapedRecipe.Shape(3, 2);
ShapedRecipe.Shape s2 = new ShapedRecipe.Shape(3, 2);
ShapedRecipe.Shape s3 = new ShapedRecipe.Shape(2, 3);

assertEquals(s1, s2);
assertEquals(s1.hashCode(), s2.hashCode());
assertNotEquals(s1, s3);
assertNotEquals(s1.hashCode(), s3.hashCode());
}

@Test
void testColumnsBounds() {
assertThrowsExactly(IllegalArgumentException.class, () ->
Expand Down

0 comments on commit 255dd46

Please sign in to comment.