@Test
public void createJwtAuthenticationAndAuthenticateTest() {

	String username = getHelper().createName();
	IdmIdentityDto identityDto = getHelper().createIdentity(username, (GuardedString) null);
	LoginDto loginDto =  new LoginDto(identityDto.getUsername(), identityDto.getPassword());
	LoginDto resultLoginDto = jwtAuthenticationService.createJwtAuthenticationAndAuthenticate(loginDto, identityDto, MODULE);
	Assert.assertTrue(securityService.isAuthenticated());
	Assert.assertEquals(username, securityService.getCurrentUsername());
	Assert.assertEquals(username, resultLoginDto.getUsername());
	Assert.assertEquals(MODULE, resultLoginDto.getAuthenticationModule());
	Assert.assertNotNull(resultLoginDto.getToken());
	IdmJwtAuthenticationDto jwtAuthenticationDto = resultLoginDto.getAuthentication();
	Assert.assertNotNull(jwtAuthenticationDto);
	Assert.assertEquals(username, jwtAuthenticationDto.getCurrentUsername());
	Assert.assertEquals(MODULE, jwtAuthenticationDto.getFromModule());
	Assert.assertTrue(resultLoginDto.getAuthorities().isEmpty());
}