"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient5/src/test/java/org/apache/hc/client5/http/HeadersMatcher.java" between
httpcomponents-client-5.2-src.tar.gz and httpcomponents-client-5.2.1-src.tar.gz

About: Apache HttpComponents Client provides reusable components for client-side authentication, HTTP state management, and HTTP connection management. Java sources.

HeadersMatcher.java  (httpcomponents-client-5.2-src):HeadersMatcher.java  (httpcomponents-client-5.2.1-src)
skipping to change at line 29 skipping to change at line 29
* ==================================================================== * ====================================================================
* *
* This software consists of voluntary contributions made by many * This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more * individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see * information on the Apache Software Foundation, please see
* <http://www.apache.org/>. * <http://www.apache.org/>.
* *
*/ */
package org.apache.hc.client5.http; package org.apache.hc.client5.http;
import java.util.Objects;
import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.util.LangUtils;
import org.hamcrest.BaseMatcher; import org.hamcrest.BaseMatcher;
import org.hamcrest.Description; import org.hamcrest.Description;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
public class HeadersMatcher extends BaseMatcher<Header[]> { public class HeadersMatcher extends BaseMatcher<Header[]> {
private final Header[] expectedHeaders; private final Header[] expectedHeaders;
public HeadersMatcher(final Header... headers) { public HeadersMatcher(final Header... headers) {
this.expectedHeaders = headers; this.expectedHeaders = headers;
skipping to change at line 52 skipping to change at line 53
@Override @Override
public boolean matches(final Object item) { public boolean matches(final Object item) {
if (item instanceof Header[]) { if (item instanceof Header[]) {
final Header[] headers = (Header[]) item; final Header[] headers = (Header[]) item;
if (headers.length == expectedHeaders.length) { if (headers.length == expectedHeaders.length) {
for (int i = 0; i < headers.length; i++) { for (int i = 0; i < headers.length; i++) {
final Header h1 = headers[i]; final Header h1 = headers[i];
final Header h2 = expectedHeaders[i]; final Header h2 = expectedHeaders[i];
if (!h1.getName().equalsIgnoreCase(h2.getName()) if (!h1.getName().equalsIgnoreCase(h2.getName())
|| !LangUtils.equals(h1.getValue(), h2.getValue())) { || !Objects.equals(h1.getValue(), h2.getValue())) {
return false; return false;
} }
} }
return true; return true;
} }
} }
return false; return false;
} }
@Override @Override
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)