@Test public void givenUserPermission_whenLogin_returnFalse() throws Exception { when(apiClient.authenticate(username, password)).thenReturn(Lists.newArrayList("USER")); assertFalse(userService.login(username, password)); }
public boolean login(String username, String password) { List<String> permissions = apiClient.authenticate(username, password); return permissions.contains("ADMIN"); }
UserService { public boolean login(String username, String password) { List<String> permissions = apiClient.authenticate(username, password); return permissions.contains("ADMIN"); } }
UserService { public boolean login(String username, String password) { List<String> permissions = apiClient.authenticate(username, password); return permissions.contains("ADMIN"); } @Inject  UserService(Application application); }
UserService { public boolean login(String username, String password) { List<String> permissions = apiClient.authenticate(username, password); return permissions.contains("ADMIN"); } @Inject  UserService(Application application); boolean login(String username, String password); }
UserService { public boolean login(String username, String password) { List<String> permissions = apiClient.authenticate(username, password); return permissions.contains("ADMIN"); } @Inject  UserService(Application application); boolean login(String username, String password);  }