use of org.apache.hc.core5.http.copied.NameValuePair in project httpcomponents-core by apache.
the class TestNameValuePair method testToString.
@Test
public void testToString() {
final NameValuePair param1 = new BasicNameValuePair("name1", "value1");
Assertions.assertEquals("name1=value1", param1.toString());
final NameValuePair param2 = new BasicNameValuePair("name1", null);
Assertions.assertEquals("name1", param2.toString());
}
use of org.apache.hc.core5.http.copied.NameValuePair in project httpcomponents-core by apache.
the class TestNameValuePair method testNullNotEqual.
@Test
public void testNullNotEqual() throws Exception {
final NameValuePair NameValuePair = new BasicNameValuePair("name", "value");
Assertions.assertNotEquals(null, NameValuePair);
}
use of org.apache.hc.core5.http.copied.NameValuePair in project httpcomponents-core by apache.
the class TestNameValuePair method testNullValuesEquals.
@Test
public void testNullValuesEquals() throws Exception {
final NameValuePair NameValuePair = new BasicNameValuePair("name", null);
final NameValuePair NameValuePair2 = new BasicNameValuePair("name", null);
Assertions.assertEquals(NameValuePair, NameValuePair2);
Assertions.assertEquals(NameValuePair.hashCode(), NameValuePair2.hashCode());
}
use of org.apache.hc.core5.http.copied.NameValuePair in project httpcomponents-core by apache.
the class TestNameValuePair method testNameEquals.
@Test
public void testNameEquals() throws Exception {
final NameValuePair NameValuePair = new BasicNameValuePair("name", "value");
final NameValuePair NameValuePair2 = new BasicNameValuePair("NAME", "value");
Assertions.assertEquals(NameValuePair, NameValuePair2);
Assertions.assertEquals(NameValuePair.hashCode(), NameValuePair2.hashCode());
final NameValuePair NameValuePair3 = new BasicNameValuePair("NAME", "value");
final NameValuePair NameValuePair4 = new BasicNameValuePair("name", "value");
Assertions.assertEquals(NameValuePair3, NameValuePair4);
Assertions.assertEquals(NameValuePair3.hashCode(), NameValuePair4.hashCode());
}
use of org.apache.hc.core5.http.copied.NameValuePair in project httpcomponents-core by apache.
the class TestBasicHeaderValueFormatter method testHEFormatting.
@Test
public void testHEFormatting() throws Exception {
final NameValuePair param1 = new BasicNameValuePair("param", "regular_stuff");
final NameValuePair param2 = new BasicNameValuePair("param", "this\\that");
final NameValuePair param3 = new BasicNameValuePair("param", "this,that");
final NameValuePair param4 = new BasicNameValuePair("param", null);
final NameValuePair[] params = new NameValuePair[] { param1, param2, param3, param4 };
final HeaderElement element = new BasicHeaderElement("name", "value", params);
final CharArrayBuffer buf = new CharArrayBuffer(64);
this.formatter.formatHeaderElement(buf, element, false);
Assertions.assertEquals("name=value; param=regular_stuff; param=\"this\\\\that\"; param=\"this,that\"; param", buf.toString());
}
Aggregations