Skip to content

Commit

Permalink
improving test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanCheshire committed Oct 27, 2023
1 parent c384c3b commit fbd7bce
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ void testResettingMutators() {
assertEquals(5150, implementationOne.getWidth());
implementationOne.resetWidth();
assertEquals(RoboHashRequestBuilderImpl.DEFAULT_WIDTH, implementationOne.getWidth());
assertThrows(IllegalArgumentException.class, () -> implementationOne.setWidth(-1));
assertThrows(IllegalArgumentException.class, () -Ï> implementationOne.setHeight(-1));
assertThrows(IllegalArgumentException.class, () -> implementationOne.setSize(new Dimension(-1, 1)));
assertThrows(IllegalArgumentException.class, () -> implementationOne.setSize(new Dimension(1, -1)));
assertThrows(IllegalArgumentException.class, () -> implementationOne.setSize(new Dimension(-1, -1)));
assertDoesNotThrow(() -> implementationOne.setSize(new Dimension(1, 1)));

implementationOne.setHeight(5150);
assertEquals(5150, implementationOne.getHeight());
Expand Down Expand Up @@ -158,6 +164,16 @@ void testResettingMutators() {
assertEquals(ImmutableList.of(ImageSet.ANY), implementationOne.getImageSets());
implementationOne.setImageSets(ImmutableList.of(ImageSet.SEXY_ROBOTS, ImageSet.DEFAULT));
assertEquals(ImmutableList.of(ImageSet.SEXY_ROBOTS, ImageSet.DEFAULT), implementationOne.getImageSets());

implementationOne.addImageSet(ImageSet.ANY);
assertTrue(implementationOne.getImageSets().contains(ImageSet.ANY));
implementationOne.addImageSet(ImageSet.KITTENS);
assertTrue(implementationOne.getImageSets().contains(ImageSet.KITTENS));
assertFalse(implementationOne.getImageSets().contains(ImageSet.ANY));

assertThrows(IllegalArgumentException.class, () -> implementationOne.addImageSets(ImmutableList.of()));
assertThrows(IllegalArgumentException.class, () -> implementationOne.removeImageSets(ImmutableList.of()));
assertThrows(IllegalArgumentException.class, () -> implementationOne.setImageSets(ImmutableList.of()));
}

/**
Expand Down

0 comments on commit fbd7bce

Please sign in to comment.