Package org.assertj.core.api
Class AbstractUriAssert<SELF extends AbstractUriAssert<SELF>>
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,URI>
org.assertj.core.api.AbstractObjectAssert<SELF,URI>
org.assertj.core.api.AbstractComparableAssert<SELF,URI>
org.assertj.core.api.AbstractUriAssert<SELF>
- Type Parameters:
SELF
- the "self" type of this assertion class.
- All Implemented Interfaces:
Assert<SELF,
,URI> ComparableAssert<SELF,
,URI> Descriptable<SELF>
,ExtensionPoints<SELF,
URI>
- Direct Known Subclasses:
UriAssert
public abstract class AbstractUriAssert<SELF extends AbstractUriAssert<SELF>>
extends AbstractComparableAssert<SELF,URI>
Base class for all implementations of assertions for
URI
s.- See Also:
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionhasAuthority
(String expected) Verifies that the actualURI
has the expected authority.hasFragment
(String expected) Verifies that the actualURI
has the expected fragment.Verifies that the actualURI
has the expected host.Verifies that the actualURI
has no fragment.Verifies that the actualURI
has no host.hasNoParameter
(String name) Verifies that the actualURI
does not have a parameter with the specified name.hasNoParameter
(String name, String value) Verifies that the actualURI
does not have a parameter with the expected name and value.Verifies that the actualURI
does not have any parameters.Verifies that the actualURI
has no path.Verifies that the actualURI
has no port.Verifies that the actualURI
has no query.Verifies that the actualURI
has no userinfo.hasParameter
(String name) Verifies that the actualURI
has a parameter with the expected name.hasParameter
(String name, String value) Verifies that the actualURI
has a parameter with the expected name and value.Verifies that the actualURI
has the expected path.hasPort
(int expected) Verifies that the actualURI
has the expected port.Verifies that the actualURI
has the expected query.Verifies that the actualURI
has the expected scheme.hasUserInfo
(String expected) Verifies that the actualURI
has the expected userinfo.Methods inherited from class org.assertj.core.api.AbstractComparableAssert
inBinary, inHexadecimal, isBetween, isEqualByComparingTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, isNotEqualByComparingTo, isStrictlyBetween, usingComparator, usingComparator, usingDefaultComparator
Methods inherited from class org.assertj.core.api.AbstractObjectAssert
as, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison
Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, describedAs, describedAs
-
Field Details
-
uris
protected org.assertj.core.internal.Uris uris
-
-
Constructor Details
-
AbstractUriAssert
-
-
Method Details
-
hasPath
Verifies that the actualURI
has the expected path.Examples:
// These assertions succeed: assertThat(new URI("http://helloworld.org/pages")).hasPath("/pages"); assertThat(new URI("http://www.helloworld.org")).hasPath(""); // this assertion fails: assertThat(new URI("http://helloworld.org/pickme")).hasPath("/pages");
- Parameters:
expected
- the expected path of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual URI path is not equal to the expected path.
-
hasNoPath
Verifies that the actualURI
has no path.Examples:
// This assertion succeeds: assertThat(new URI("mailto:[email protected]")).hasNoPath(); // these assertions fail: assertThat(new URI("http://helloworld.org")).hasNoPath(); // empty path assertThat(new URI("http://helloworld.org/france")).hasNoPath();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a path.
-
hasPort
Verifies that the actualURI
has the expected port.Examples:
// These assertions succeed: assertThat(new URI("http://helloworld.org:8080")).hasPort(8080); // These assertions fail: assertThat(new URI("http://helloworld.org:8080")).hasPort(9876); assertThat(new URI("http://helloworld.org")).hasPort(8080); assertThat(new URI("helloworld.org:8080")).hasPort(8080);
- Parameters:
expected
- the expected port of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual port is not equal to the expected port.
-
hasNoPort
Verifies that the actualURI
has no port.Examples:
// These assertions succeed: assertThat(new URI("http://helloworld.org")).hasNoPort(); // This assertion fails: assertThat(new URI("http://helloworld.org:8080")).hasNoPort();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a port.
-
hasHost
Verifies that the actualURI
has the expected host.Examples:
// These assertions succeed: assertThat(new URI("http://helloworld.org")).hasAuthority("helloworld.org"); assertThat(new URI("http://helloworld.org/pages")).hasHost("helloworld.org"); assertThat(new URI("http://helloworld.org:8080")).hasHost("helloworld.org"); // These assertions fail: assertThat(new URI("http://www.helloworld.org")).hasHost("helloworld.org"); assertThat(new URI("http://www.helloworld.org:8080")).hasHost("helloworld.org");
- Parameters:
expected
- the expected host of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual host is not equal to the expected host.
-
hasNoHost
Verifies that the actualURI
has no host.Examples:
// This assertion succeeds: assertThat(new URI("file:///home/user/Documents/hello-world.txt")).hasNoHost(); // This assertion fails: assertThat(new URI("http://helloworld.org:8080/index.html")).hasNoHost();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a host.- Since:
- 3.22.0
-
hasAuthority
Verifies that the actualURI
has the expected authority.Examples:
// These assertions succeed: assertThat(new URI("http://helloworld.org:8080")).hasAuthority("helloworld.org:8080"); assertThat(new URI("http://www.helloworld.org:8080/news")).hasAuthority("www.helloworld.org:8080"); // These assertions fail: assertThat(new URI("http://www.helloworld.org:8080")).hasAuthority("www.helloworld.org"); assertThat(new URI("http://www.helloworld.org")).hasAuthority("www.helloworld.org:8080");
- Parameters:
expected
- the expected authority of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual authority is not equal to the expected authority.
-
hasFragment
Verifies that the actualURI
has the expected fragment.Examples:
// This assertion succeeds: assertThat(new URI("http://helloworld.org:8080/index.html#print")).hasFragment("print"); // These assertions fail: assertThat(new URI("http://helloworld.org:8080/index.html#print")).hasFragment("hello"); assertThat(new URI("http://helloworld.org:8080/index.html")).hasFragment("hello");
- Parameters:
expected
- the expected fragment of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual fragment is not equal to the expected fragment.
-
hasNoFragment
Verifies that the actualURI
has no fragment.Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoFragment(); // This assertion fails: assertThat(new URI("http://helloworld.org:8080/index.html#print")).hasNoFragment();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a fragment.
-
hasQuery
Verifies that the actualURI
has the expected query.Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html?type=test")).hasQuery("type=test"); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?type=test")).hasQuery("type=hello"); assertThat(new URI("http://www.helloworld.org/index.html")).hasQuery("type=hello");
- Parameters:
expected
- the expected query of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual query is not equal to the expected query.
-
hasNoQuery
Verifies that the actualURI
has no query.Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoQuery(); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?type=test")).hasNoQuery();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a query.
-
hasScheme
Verifies that the actualURI
has the expected scheme.Examples:
// This assertion succeeds: assertThat(new URI("ftp://helloworld.org")).hasScheme("ftp"); // These assertion fails: assertThat(new URI("http://helloworld.org")).hasScheme("ftp");
- Parameters:
expected
- the expected scheme of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual scheme is not equal to the expected scheme.
-
hasUserInfo
Verifies that the actualURI
has the expected userinfo.Examples:
// These assertions succeed: assertThat(new URI("http://test:[email protected]/index.html")).hasUserInfo("test:pass"); assertThat(new URI("http://[email protected]/index.html")).hasUserInfo("test"); assertThat(new URI("http://:[email protected]/index.html")).hasUserInfo(":pass"); // These assertions fail: assertThat(new URI("http://test:[email protected]/index.html")).hasUserInfo("test:fail"); assertThat(new URI("http://www.helloworld.org/index.html")).hasUserInfo("test:pass");
- Parameters:
expected
- the expected userinfo of the actualURI
.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual userinfo is not equal to the expected userinfo.
-
hasNoUserInfo
Verifies that the actualURI
has no userinfo.Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoUserInfo(); // This assertion fails: assertThat(new URI("http://test:[email protected]/index.html")).hasNoUserInfo();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has some userinfo.
-
hasParameter
Verifies that the actualURI
has a parameter with the expected name.The value of the parameter is not checked.
Examples:
// These assertions succeed: assertThat(new URI("http://www.helloworld.org/index.html?happy")).hasParameter("happy"); assertThat(new URI("http://www.helloworld.org/index.html?happy=very")).hasParameter("happy"); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html")).hasParameter("happy"); assertThat(new URI("http://www.helloworld.org/index.html?sad=much")).hasParameter("happy");
- Parameters:
name
- the name of the parameter expected to be present.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual does not have the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.- Since:
- 2.5.0 / 3.5.0
-
hasParameter
Verifies that the actualURI
has a parameter with the expected name and value.Use
null
to indicate an absent value (e.g.foo&bar
) as opposed to an empty value (e.g.foo=&bar=
).Examples:
// These assertions succeed: assertThat(new URI("http://www.helloworld.org/index.html?happy")).hasParameter("happy", null); assertThat(new URI("http://www.helloworld.org/index.html?happy=very")).hasParameter("happy", "very"); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?sad")).hasParameter("sad", "much"); assertThat(new URI("http://www.helloworld.org/index.html?sad=much")).hasParameter("sad", null);
- Parameters:
name
- the name of the parameter expected to be present.value
- the value of the parameter expected to be present.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual does not have the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.- Since:
- 2.5.0 / 3.5.0
-
hasNoParameters
Verifies that the actualURI
does not have any parameters.Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoParameters(); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?sad")).hasNoParameters(); assertThat(new URI("http://www.helloworld.org/index.html?sad=much")).hasNoParameters();
- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has a parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.- Since:
- 2.5.0 / 3.5.0
-
hasNoParameter
Verifies that the actualURI
does not have a parameter with the specified name.The value of the parameter is not checked.
Examples:
// This assertion succeeds: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoParameter("happy"); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?sad")).hasNoParameter("sad"); assertThat(new URI("http://www.helloworld.org/index.html?sad=much")).hasNoParameter("sad");
- Parameters:
name
- the name of the parameter expected to be absent.- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.
-
hasNoParameter
Verifies that the actualURI
does not have a parameter with the expected name and value.Use
null
to indicate an absent value (e.g.foo&bar
) as opposed to an empty value (e.g.foo=&bar=
).Examples:
// These assertions succeed: assertThat(new URI("http://www.helloworld.org/index.html")).hasNoParameter("happy", "very"); assertThat(new URI("http://www.helloworld.org/index.html?happy")).hasNoParameter("happy", "very"); assertThat(new URI("http://www.helloworld.org/index.html?happy=very")).hasNoParameter("happy", null); // These assertions fail: assertThat(new URI("http://www.helloworld.org/index.html?sad")).hasNoParameter("sad", null); assertThat(new URI("http://www.helloworld.org/index.html?sad=much")).hasNoParameter("sad", "much");
- Parameters:
name
- the name of the parameter expected to be absent.value
- the value of the parameter expected to be absent.- Returns:
this
assertion object.- Throws:
AssertionError
- ifactual
has the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.
-