Search in sources :

Example 11 with IdentityCookieConfig

use of org.wso2.carbon.identity.core.model.IdentityCookieConfig in project carbon-identity-framework by wso2.

the class IdentityUtilTest method testGetIdentityCookieConfig.

@Test
public void testGetIdentityCookieConfig() throws Exception {
    Map<String, IdentityCookieConfig> mockIdentityCookiesConfigurationHolder = new HashMap<>();
    IdentityCookieConfig cookieConfig = new IdentityCookieConfig("cookieName");
    mockIdentityCookiesConfigurationHolder.put("cookie", cookieConfig);
    Whitebox.setInternalState(IdentityUtil.class, "identityCookiesConfigurationHolder", mockIdentityCookiesConfigurationHolder);
    assertEquals(IdentityUtil.getIdentityCookieConfig("cookie"), cookieConfig, "Invalid cookie config value " + "for: cookie");
    assertNull(IdentityUtil.getIdentityCookieConfig("nonExisting"), "Non existing cookie key should be returned " + "with null");
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) IdentityCookieConfig(org.wso2.carbon.identity.core.model.IdentityCookieConfig) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

IdentityCookieConfig (org.wso2.carbon.identity.core.model.IdentityCookieConfig)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 Test (org.testng.annotations.Test)6 SameSiteCookie (org.wso2.carbon.core.SameSiteCookie)6 Cookie (javax.servlet.http.Cookie)5 CookieBuilder (org.wso2.carbon.identity.core.model.CookieBuilder)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 Matchers.anyString (org.mockito.Matchers.anyString)3 BeforeTest (org.testng.annotations.BeforeTest)3 PowerMockIdentityBaseTest (org.wso2.carbon.identity.testutil.powermock.PowerMockIdentityBaseTest)3 QName (javax.xml.namespace.QName)1 OMElement (org.apache.axiom.om.OMElement)1 IdentityCacheConfig (org.wso2.carbon.identity.core.model.IdentityCacheConfig)1 IdentityCacheConfigKey (org.wso2.carbon.identity.core.model.IdentityCacheConfigKey)1 IdentityEventListenerConfig (org.wso2.carbon.identity.core.model.IdentityEventListenerConfig)1 IdentityEventListenerConfigKey (org.wso2.carbon.identity.core.model.IdentityEventListenerConfigKey)1