コード例 #1
0
 @Test
 public void too_many_coords_input_throws() throws Exception {
   try {
     command.setPlateauBound("1,2,3");
     fail("IllegalArgumentException not thrown");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage()).isEqualTo("Too many input coordinates: 1 2 3");
   }
 }
コード例 #2
0
 @Test
 public void too_few_coords_input_throws() throws Exception {
   try {
     command.setPlateauBound("1");
     fail("IllegalArgumentException not thrown");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage()).isEqualTo("Too few input coordinates. Only got one: 1");
   }
 }
コード例 #3
0
  @Test
  public void testDemergeWithNullIsRejected() {
    MockPasswordEncoder pwd = new MockPasswordEncoder();

    try {
      pwd.nowDemergePasswordAndSalt(null);
      fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      assertThat(expected.getMessage()).isEqualTo("Cannot pass a null or empty String");
    }
  }
コード例 #4
0
  @Test
  public void testStrictMergeRejectsDelimitersInSalt2() {
    MockPasswordEncoder pwd = new MockPasswordEncoder();

    try {
      pwd.nowMergePasswordAndSalt("password", "f}oo", true);
      fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      assertThat(expected.getMessage()).isEqualTo("Cannot use { or } in salt.toString()");
    }
  }