@Test
public void shouldAddCredentialsToClaudiaDataWhenAuthenticatedWithToken() {

    // given
    ClaudiaData claudiaData = new ClaudiaData("org", "vdc", "service");
    SecurityContext context = mock(SecurityContext.class);
    SecurityContextHolder.setContext(context);
    UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = mock(UsernamePasswordAuthenticationToken.class);
    when(context.getAuthentication()).thenReturn(usernamePasswordAuthenticationToken);
    when(usernamePasswordAuthenticationToken.getPrincipal()).thenReturn("token1");
    when(usernamePasswordAuthenticationToken.getCredentials()).thenReturn("tenantId1");
    // when
    OpenStackAuthenticationProvider.addCredentialsToClaudiaData(claudiaData);
    // then
    assertNotNull(claudiaData);
    assertEquals("org", claudiaData.getOrg());
    assertEquals("vdc", claudiaData.getVdc());
    assertEquals("service", claudiaData.getService());
    assertEquals("token1", claudiaData.getUser().getToken());
    assertEquals("tenantId1", claudiaData.getUser().getTenantId());
    assertEquals("", claudiaData.getUser().getTenantName());
}