### Question:
HadoopAuthCookieStore extends BasicCookieStore { @Override public void addCookie(Cookie cookie) { if (isAuthCookie(cookie) && isKnoxCookie(cookie)) { Wrapper wrapper = new Wrapper(cookie); LOG.acceptingServiceCookie(wrapper); super.addCookie(wrapper); } } HadoopAuthCookieStore(GatewayConfig config); @Override void addCookie(Cookie cookie);  }### Answer:
@Test public void testOozieCookieWorkaroundKnox1171() { String rawValue = "u=knox&p=knox/host.example.com.com@EXAMPLE.COM&t=kerberos&e=1517900515610&s=HpSXUOhoXR/2wXrsgPz5lSbNuf8="; String quotedValue = "\""+rawValue+"\""; HadoopAuthCookieStore store; List<Cookie> cookies; Cookie cookie; GatewayConfig gatewayConfig = EasyMock.createNiceMock(GatewayConfig.class); File krb5LoginConf = createTestKrb5LoginConfigFile("krb5JAASLogin", getTestKrb5LoginConf("knox/host.example.com.com@EXAMPLE.COM")); assertNotNull(krb5LoginConf); EasyMock.expect(gatewayConfig.getKerberosLoginConfig()).andReturn(krb5LoginConf.getAbsolutePath()).anyTimes(); EasyMock.replay(gatewayConfig); store = new HadoopAuthCookieStore(gatewayConfig); store.addCookie( new BasicClientCookie( "hadoop.auth", rawValue ) ); cookies = store.getCookies(); cookie = cookies.get( 0 ); assertThat( cookie.getValue(), is(quotedValue) ); store = new HadoopAuthCookieStore(gatewayConfig); store.addCookie( new BasicClientCookie( "hadoop.auth", quotedValue ) ); cookies = store.getCookies(); cookie = cookies.get( 0 ); assertThat( cookie.getValue(), is(quotedValue) ); store = new HadoopAuthCookieStore(gatewayConfig); store.addCookie( new BasicClientCookie( "hadoop.auth", null ) ); cookies = store.getCookies(); assertNotNull(cookies); assertTrue(cookies.isEmpty()); store = new HadoopAuthCookieStore(gatewayConfig); store.addCookie( new BasicClientCookie( "hadoop.auth", "" ) ); cookies = store.getCookies(); assertNotNull(cookies); assertTrue(cookies.isEmpty()); }