AppCookieManager { static String getHadoopAuthCookieValue(Header[] headers) { if (headers == null) { return null; } for (Header header : headers) { HeaderElement[] elements = header.getElements(); for (HeaderElement element : elements) { String cookieName = element.getName(); if (cookieName.equals(HADOOP_AUTH)) { if (element.getValue() != null) { String trimmedVal = element.getValue().trim(); if (!trimmedVal.isEmpty()) { return trimmedVal; } } } } } return null; } AppCookieManager(); static void main(String[] args); String getAppCookie(String endpoint, boolean refresh); String getCachedAppCookie(String endpoint);  }
@Test public void getHadoopAuthCookieValueWithNullHeaders() { assertNull(AppCookieManager.getHadoopAuthCookieValue(null)); }
@Test public void getHadoopAuthCookieValueWitEmptylHeaders() { assertNull(AppCookieManager.getHadoopAuthCookieValue(new Header[0])); }
@Test public void getHadoopAuthCookieValueWithValidlHeaders() { Header[] headers = new Header[1]; headers[0] = new BasicHeader("Set-Cookie", AppCookieManager.HADOOP_AUTH + "=dummyvalue"); assertNotNull(AppCookieManager.getHadoopAuthCookieValue(headers)); }