@Test public void testSecretAsUser() { Security.login("me"); try { secretDataHolder.getData(); fail(); } catch (Exception e) { // Ok } }
@Test public void testSecretAsAdmin() { Security.login("admin"); assertThat(secretDataHolder.getData()).isEqualTo("secret"); }
@Test public void testPublicAsAdmin() { Security.login("admin"); assertThat(publicDataHolder.getData()).isEqualTo("public"); }