public class TestMIMEType
extends junit.framework.TestCase
MIMEType
.Modifier and Type | Class and Description |
---|---|
static class |
TestMIMEType.AssertionFailedError2
Helper class.
|
static class |
TestMIMEType.Criteria
Note: This class is reused by
TestAcceptMIMEType . |
Constructor and Description |
---|
TestMIMEType() |
Modifier and Type | Method and Description |
---|---|
static void |
doAcceptanceTest(String data,
TestMIMEType.Criteria criteria)
Test helper method attempts to parse a MIME expression and then
validates the parse against the provided
TestMIMEType.Criteria and
then tests for round-trip fidelity as well. |
static void |
doDoesNotSpanTest(MIMEType t1,
MIMEType t2,
boolean compareParams)
Test helper method for testing the
MIMEType#spans(
Object o, boolean compareParams ) implementation. |
static void |
doEqualTest(MIMEType t1,
MIMEType t2)
Test helper method for testing the
MIMEType.equals(
Object o ) implementation. |
static void |
doIntersectionTest(MIMEType a,
MIMEType b,
MIMEType expectedResult) |
static void |
doNotEqualTest(MIMEType t1,
MIMEType t2)
Test helper method for testing the
MIMEType.equals(
Object o ) implementation. |
static void |
doRejectionTest(String data,
Class exceptionClass)
Test helper submits data that should produce an exception of
the indicated class.
|
static void |
doSpansTest(MIMEType t1,
MIMEType t2,
boolean compareParams)
Test helper method for testing the
MIMEType#spans(
Object o, boolean compareParams ) implementation. |
static junit.framework.Test |
suite() |
void |
test_equals_1() |
void |
test_equals_2() |
void |
test_equals_3() |
void |
test_equals_4() |
void |
test_intersection_1() |
void |
test_intersection_2() |
void |
test_intersection_3() |
void |
test_intersection_4() |
void |
test_intersection_5() |
void |
test_intersection_6() |
void |
test_intersection_7() |
void |
test_LWS_1()
test_LWS_# : test suite for correct acceptance and correct
rejection of (linear whitespace).
|
void |
test_LWS_10() |
void |
test_LWS_11() |
void |
test_LWS_2() |
void |
test_LWS_3() |
void |
test_LWS_4() |
void |
test_LWS_5() |
void |
test_LWS_6() |
void |
test_LWS_7() |
void |
test_LWS_8() |
void |
test_matches_1()
Test verifies that a specific MIME type matches the same MIME
type when the latter is expressed as a
String . |
void |
test_matches_2()
Test verifies that a specific MIME type matches the same MIME
type when the latter is expressed as a
MIMEType . |
void |
test_matches_3()
Test verifies that a wildcard subtype matches a specific MIME
type and subtype.
|
void |
test_matches_4()
Test should succeed since the MIME parameters are being
ignored, but it would succeed even if the MIME parameters were
being compared.
|
void |
test_matches_5()
Verifies that the MIME parameters are not compared since the
test would fail if they were being compared.
|
void |
test_no_intersection_1() |
void |
test_no_intersection_2() |
void |
test_no_intersection_3() |
void |
test_not_equals_1() |
void |
test_not_equals_2() |
void |
test_not_equals_3() |
void |
test_not_equals_4()
This case shows that the default parameter "q" is NOT
recognized by the base
MIMEType class. |
void |
test_precedence_order_1()
This test series is based on an example in RFC 1616, section
14.1, page 63.
|
void |
test_precedence_order_2() |
void |
test_precedence_order_3() |
void |
test_separator_1()
Tests for correct rejection of trailing semicolon.
|
void |
test_spans_A_equals_B_with_extra_params_on_B()
Tests that
A spans B and that B does not
span A when B has same type and subtype but also
specifies one or more parameters which are not included in A. |
void |
test_spans_subtype_1()
Tests that a subtype wildcard spans any specific subtype.
|
void |
test_spans_subtype_2() |
void |
test_spans_subtype_3() |
void |
test_spans_when_A_equals_B_same_params()
Tests that
A spans B and B spans A
when A == B and A and B both specify the same MIME
type parameters (same MIME type expressions). |
void |
test_spans_when_A_equals_B()
Tests that
A spans B when A == B . |
void |
test_spans_will_ingore_parameters_when_asked_to()
Tests that the spans implementation correctly ignores the
specified MIME type parameters when we ask it to.
|
void |
testAccept_wildcard_subtype()
Basic acceptance tests for type and subtype wildcards.
|
void |
testAccept_wildcard_type_and_subtype() |
void |
testAccept1_audio_basic() |
void |
testAccept1_text_xml()
testAccept# : basic test suite for correct parsing of type,
subtype and parameters.
|
void |
testAccept2() |
void |
testAccept3() |
void |
testAccept4() |
void |
testAccept5() |
void |
testAccept6() |
void |
testAcceptMultipart_1()
multipart/mixed mime type test.
|
void |
testAcceptMultipart_2()
multipart/signed mime type test.
|
void |
testReject_wildcard_type_only() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
public static junit.framework.Test suite()
public static void doAcceptanceTest(String data, TestMIMEType.Criteria criteria)
TestMIMEType.Criteria
and
then tests for round-trip fidelity as well.public static void doRejectionTest(String data, Class exceptionClass)
public void testAccept1_text_xml()
public void testAccept1_audio_basic()
public void testAccept2()
public void testAccept3()
public void testAccept4()
public void testAccept5()
public void testAccept6()
public void testAcceptMultipart_1()
public void testAcceptMultipart_2()
public void testAccept_wildcard_subtype()
public void testAccept_wildcard_type_and_subtype()
public void testReject_wildcard_type_only()
public void test_LWS_1()
public void test_LWS_2()
public void test_LWS_3()
public void test_LWS_4()
public void test_LWS_5()
public void test_LWS_6()
public void test_LWS_7()
public void test_LWS_8()
public void test_LWS_10()
public void test_LWS_11()
public void test_separator_1()
public void test_matches_1()
String
.public void test_matches_2()
MIMEType
.public void test_matches_3()
public void test_matches_4()
public void test_matches_5()
public static void doEqualTest(MIMEType t1, MIMEType t2)
MIMEType.equals(
Object o )
implementation.
Note: This does NOT accept String
MIME type expressions
so that it may be reused as part of the test harness for
classes that extend MIMEType
.
public static void doNotEqualTest(MIMEType t1, MIMEType t2)
MIMEType.equals(
Object o )
implementation.
Note: This does NOT accept String
MIME type expressions
so that it may be reused as part of the test harness for
classes that extend MIMEType
.
public void test_equals_1()
public void test_equals_2()
public void test_equals_3()
public void test_equals_4()
public void test_not_equals_1()
public void test_not_equals_2()
public void test_not_equals_3()
public void test_not_equals_4()
MIMEType
class. However that
default parameter SHOULD be recognized by the AcceptMIMEType
- which is tested by TestAcceptMIMEType
.public static void doDoesNotSpanTest(MIMEType t1, MIMEType t2, boolean compareParams)
public void test_spans_when_A_equals_B()
A spans B
when A == B
.public void test_spans_when_A_equals_B_same_params()
A spans B
and B spans A
when A == B
and A and B both specify the same MIME
type parameters (same MIME type expressions).public void test_spans_will_ingore_parameters_when_asked_to()
public void test_spans_A_equals_B_with_extra_params_on_B()
A spans B
and that B does not
span A
when B has same type and subtype but also
specifies one or more parameters which are not included in A.public void test_spans_subtype_1()
public void test_spans_subtype_2()
public void test_spans_subtype_3()
public void test_precedence_order_1()
Accept
header.
Media ranges can be overridden by more specific media ranges or specific media types. If more than one media range applies to a given type, the most specific reference has precedence. For example,
Accept: text/*, text/html, text/html;level=1, * / *have the following precedence:
1) text/html;level=1 2) text/html 3) text/* 4) * / *
public void test_precedence_order_2()
public void test_precedence_order_3()
public void test_intersection_1()
public void test_intersection_2()
public void test_intersection_3()
public void test_intersection_4()
public void test_intersection_5()
public void test_intersection_6()
public void test_intersection_7()
public void test_no_intersection_1()
public void test_no_intersection_2()
public void test_no_intersection_3()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.