コード例 #1
0
 private void throwIfUserIs(User user) {
   if (SecurityUtil.getLoggedInUser().getUsername().equals(user.getUsername())) {
     throw new IllegalStateException("Thrown when user was " + user);
   }
 }
コード例 #2
0
 @Test
 public void consumerLoggedIn() {
   logInAs(LoginRole.CONSUMER);
   assertThat(SecurityUtil.getLoggedInUser().getUsername(), is(getConsumer().getUsername()));
 }
コード例 #3
0
 private void throwIfUserRole(String identifier) {
   User.Role identifierRole = stringToRole(UserIdentifier.parse(identifier).getIdentifier());
   if (SecurityUtil.getLoggedInUser().getRole() == identifierRole) {
     throw new IllegalStateException("Thrown when role was " + identifier);
   }
 }
コード例 #4
0
 @Test
 public void producerLoggedIn() {
   assertThat(SecurityUtil.getLoggedInUser().getUsername(), is(getProducer().getUsername()));
 }