Issue #3444 - Adding testcase for HttpFields.add(PreEncoded|HttpField)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
beb4881af4
commit
133a4a10c0
|
@ -18,15 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.http;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
|
@ -40,6 +31,15 @@ import org.eclipse.jetty.util.BufferUtil;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class HttpFieldsTest
|
||||
{
|
||||
@Test
|
||||
|
@ -299,6 +299,28 @@ public class HttpFieldsTest
|
|||
assertEquals(false, e.hasMoreElements());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddPreEncodedField()
|
||||
{
|
||||
final PreEncodedHttpField X_XSS_PROTECTION_FIELD = new PreEncodedHttpField("X-XSS-Protection", "1; mode=block");
|
||||
|
||||
HttpFields fields = new HttpFields();
|
||||
fields.add(X_XSS_PROTECTION_FIELD);
|
||||
|
||||
assertThat("Fields output", fields.toString(), containsString("X-XSS-Protection: 1; mode=block"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddFinalHttpField()
|
||||
{
|
||||
final HttpField X_XSS_PROTECTION_FIELD = new HttpField("X-XSS-Protection", "1; mode=block");
|
||||
|
||||
HttpFields fields = new HttpFields();
|
||||
fields.add(X_XSS_PROTECTION_FIELD);
|
||||
|
||||
assertThat("Fields output", fields.toString(), containsString("X-XSS-Protection: 1; mode=block"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValues() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue