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