Example #1
0
 private User findUser(String id) {
   final User reader = userDAO.findById(id);
   if (reader == null) {
     throw new WebApplicationException(Status.NOT_FOUND);
   }
   return reader;
 }
Example #2
0
    public void setup() throws Exception {
      this.unlockedKeySet = mock(UnlockedKeySet.class);

      this.keySet = mock(KeySet.class);
      when(keySet.unlock(any(char[].class))).thenReturn(unlockedKeySet);

      this.user = mock(User.class);
      when(user.getId()).thenReturn("woo");
      when(user.getKeySet()).thenReturn(keySet);

      this.userDAO = mock(UserDAO.class);
      when(userDAO.findById("woo")).thenReturn(user);

      this.creds = new Credentials("woo", "hah");
    }