コード例 #1
0
 @Test
 public void shouldFailWithNoRoles() {
   roleBasedIdentity.addRoles();
   assertThatThrownBy(() -> controller.doWork())
       .isInstanceOf(MissingRolesException.class)
       .hasMessageContaining("jane, bob, ralph");
 }
コード例 #2
0
 @Test
 public void shouldSucceedWithAllRoles() {
   roleBasedIdentity.addRoles("jane", "bob", "ralph");
   String s = controller.doWork();
   assertThat(s).isEqualTo(SUCCESS);
 }