@Test public void testGetAuthentications() { Map<String, Authentication> auths = apiClient.getAuthentications(); Authentication auth = auths.get("api_key"); assertNotNull(auth); assertTrue(auth instanceof ApiKeyAuth); ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth; assertEquals("header", apiKeyAuth.getLocation()); assertEquals("api_key", apiKeyAuth.getParamName()); auth = auths.get("petstore_auth"); assertTrue(auth instanceof OAuth); assertSame(auth, apiClient.getAuthentication("petstore_auth")); assertNull(auths.get("unknown")); try { auths.put("my_auth", new HttpBasicAuth()); fail("the authentications returned should not be modifiable"); } catch (UnsupportedOperationException e) { } }