S
- the "self" type of this assertion class.public abstract class AbstractUriAssert<S extends AbstractUriAssert<S>> extends AbstractAssert<S,URI>
URI
s.URI
Modifier and Type | Field and Description |
---|---|
protected Uris |
uris |
actual, info, myself
Constructor and Description |
---|
AbstractUriAssert(URI actual,
Class<?> selfType) |
Modifier and Type | Method and Description |
---|---|
S |
hasAuthority(String expected)
Verifies that the actual
URI has the expected authority. |
S |
hasFragment(String expected)
Verifies that the actual
URI has the expected fragment. |
S |
hasHost(String expected)
Verifies that the actual
URI has the expected host. |
S |
hasNoFragment()
Verifies that the actual
URI has no fragment. |
S |
hasNoParameter(String name)
Verifies that the actual
URI does not have a parameter with the specified name. |
S |
hasNoParameter(String name,
String value)
Verifies that the actual
URI does not have a parameter with the expected name and value. |
S |
hasNoParameters()
Verifies that the actual
URI does not have any parameters. |
S |
hasNoPath()
Verifies that the actual
URI has no path. |
S |
hasNoPort()
Verifies that the actual
URI has no port. |
S |
hasNoQuery()
Verifies that the actual
URI has no query. |
S |
hasNoUserInfo()
Verifies that the actual
URI has no userinfo. |
S |
hasParameter(String name)
Verifies that the actual
URI has a parameter with the expected name. |
S |
hasParameter(String name,
String value)
Verifies that the actual
URI has a parameter with the expected name and value. |
S |
hasPath(String expected)
Verifies that the actual
URI has the expected path. |
S |
hasPort(int expected)
Verifies that the actual
URI has the expected port. |
S |
hasQuery(String expected)
Verifies that the actual
URI has the expected query. |
S |
hasScheme(String expected)
Verifies that the actual
URI has the expected scheme. |
S |
hasUserInfo(String expected)
Verifies that the actual
URI has the expected userinfo. |
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, overridingErrorMessage, satisfies, setCustomRepresentation, throwAssertionError, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
protected Uris uris
public S hasPath(String expected)
URI
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");
expected
- the expected path of the actual URI
.this
assertion object.AssertionError
- if the actual URI path is not equal to the expected path.public S hasNoPath()
URI
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();
this
assertion object.AssertionError
- if the actual has a path.public S hasPort(int expected)
URI
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);
expected
- the expected port of the actual URI
.this
assertion object.AssertionError
- if the actual port is not equal to the expected port.public S hasNoPort()
URI
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();
this
assertion object.AssertionError
- if the actual has a port.public S hasHost(String expected)
URI
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");
expected
- the expected host of the actual URI
.this
assertion object.AssertionError
- if the actual host is not equal to the expected host.public S hasAuthority(String expected)
URI
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");
expected
- the expected authority of the actual URI
.this
assertion object.AssertionError
- if the actual authority is not equal to the expected authority.public S hasFragment(String expected)
URI
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");
expected
- the expected fragment of the actual URI
.this
assertion object.AssertionError
- if the actual fragment is not equal to the expected fragment.public S hasNoFragment()
URI
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();
this
assertion object.AssertionError
- if the actual has a fragment.public S hasQuery(String expected)
URI
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");
expected
- the expected query of the actual URI
.this
assertion object.AssertionError
- if the actual query is not equal to the expected query.public S hasNoQuery()
URI
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();
this
assertion object.AssertionError
- if the actual has a query.public S hasScheme(String expected)
URI
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");
expected
- the expected scheme of the actual URI
.this
assertion object.AssertionError
- if the actual scheme is not equal to the expected scheme.public S hasUserInfo(String expected)
URI
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");
expected
- the expected userinfo of the actual URI
.this
assertion object.AssertionError
- if the actual userinfo is not equal to the expected userinfo.public S hasNoUserInfo()
URI
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();
this
assertion object.AssertionError
- if the actual has some userinfo.public S hasParameter(String name)
URI
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");
name
- the name of the parameter expected to be present.this
assertion object.AssertionError
- if the actual does not have the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.public S hasParameter(String name, String value)
URI
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);
name
- the name of the parameter expected to be present.value
- the value of the parameter expected to be present.this
assertion object.AssertionError
- if the actual does not have the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.public S hasNoParameters()
URI
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();
this
assertion object.AssertionError
- if the actual has a parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.public S hasNoParameter(String name)
URI
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");
name
- the name of the parameter expected to be absent.this
assertion object.AssertionError
- if the actual has the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.public S hasNoParameter(String name, String value)
URI
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");
name
- the name of the parameter expected to be absent.value
- the value of the parameter expected to be absent.this
assertion object.AssertionError
- if the actual has the expected parameter.IllegalArgumentException
- if the query string contains an invalid escape sequence.Copyright © 2014–2017 AssertJ. All rights reserved.