"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient5/src/test/java/org/apache/hc/client5/http/NameValuePairsMatcher.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.

NameValuePairsMatcher.java  (httpcomponents-client-5.2-src):NameValuePairsMatcher.java  (httpcomponents-client-5.2.1-src)
skipping to change at line 33 skipping to change at line 33
* 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.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects;
import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.NameValuePair;
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 NameValuePairsMatcher extends BaseMatcher<Collection<? extends Name ValuePair>> { public class NameValuePairsMatcher extends BaseMatcher<Collection<? extends Name ValuePair>> {
private final List<? extends NameValuePair> expectedNameValuePairList; private final List<? extends NameValuePair> expectedNameValuePairList;
public NameValuePairsMatcher(final List<? extends NameValuePair> nameValuePa irList) { public NameValuePairsMatcher(final List<? extends NameValuePair> nameValuePa irList) {
this.expectedNameValuePairList = nameValuePairList; this.expectedNameValuePairList = nameValuePairList;
skipping to change at line 58 skipping to change at line 58
@Override @Override
public boolean matches(final Object item) { public boolean matches(final Object item) {
if (item instanceof Collection<?>) { if (item instanceof Collection<?>) {
final Collection<?> collection = (Collection<?>) item; final Collection<?> collection = (Collection<?>) item;
int i = 0; int i = 0;
for (final Object obj : collection) { for (final Object obj : collection) {
if (obj instanceof NameValuePair) { if (obj instanceof NameValuePair) {
final NameValuePair nvp1 = (NameValuePair) obj; final NameValuePair nvp1 = (NameValuePair) obj;
final NameValuePair nvp2 = expectedNameValuePairList.get(i); final NameValuePair nvp2 = expectedNameValuePairList.get(i);
if (!nvp1.getName().equalsIgnoreCase(nvp2.getName()) if (!nvp1.getName().equalsIgnoreCase(nvp2.getName())
|| !LangUtils.equals(nvp1.getValue(), nvp2.getValue( ))) { || !Objects.equals(nvp1.getValue(), nvp2.getValue()) ) {
return false; return false;
} }
} else { } else {
return false; return false;
} }
i++; i++;
} }
return true; return true;
} }
return false; return false;
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added

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