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"); }