elvyssoares

DoubletonSetTest - Refactored

May 19th, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. private void assertUnchanged() {
  2.     Verify.assertSize(2, this.set);
  3.     Verify.assertContainsAll(this.set, "1", "2");
  4.     Verify.assertNotContains("3", this.set);
  5. }
  6.  
  7. @Test
  8. public void addDuplicate() {
  9.     Throwable thrown = catchThrowable(() -> this.set.add("1"));
  10.     assertThat(thrown).isInstanceOf(UnsupportedOperationException.class);
  11.     this.assertUnchanged();
  12. }
Advertisement
Add Comment
Please, Sign In to add comment