class AuthenticationService {

    public LoginToken authenticate(String username, String password) {
        // TODO use REST template to communicate the backend
        RestTemplate restTemplate = new RestTemplate();

        MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
        multiValueMap.add("username", username);
        multiValueMap.add("password", password);
        LoginToken loginToken = restTemplate.postForObject(authUrl, multiValueMap, LoginToken.class);

        return loginToken;
    }

}

class AuthenticationServiceTest {

    @Autowired
    private AuthenticationService authenticationService;

    @Test
    public void authenticate_incorrect() {

        LoginToken loginToken = authenticationService.authenticate("kmh", "abcd1234xx");
        assertNull(loginToken.getUsername());
        assertNull(loginToken.getFullname());
        assertEquals("norole", loginToken.getRole());
    }

}