public class PropertyContainerAssert<A extends PropertyContainerAssert<A,T>,T extends org.neo4j.graphdb.PropertyContainer>
extends org.assertj.core.api.AbstractAssert<A,T>
PropertyContainer
Modifier | Constructor and Description |
---|---|
protected |
PropertyContainerAssert(T actual,
Class<? extends A> assertClass) |
Modifier and Type | Method and Description |
---|---|
A |
doesNotHaveProperty(String key,
Object value)
Verifies that the actual
PropertyContainer does not have a property with given key and value. |
A |
doesNotHavePropertyKey(String key)
Verifies that the actual
PropertyContainer does not have the given property keyExample: GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node node = graph.createNode(); node.setProperty("firstName", "Homer"); assertThat(node).doesNotHavePropertyKey("lastName"); // it also works with relationships: Relationship relationship = homer.createRelationshipTo(donut, DynamicRelationshipType.withName("LOVES")); relationship.setProperty("firstName", "Homer"); assertThat(relationship).doesNotHavePropertyKey("lastName"); If the key is null , an IllegalArgumentException is thrown. |
T |
getActual() |
A |
hasProperty(String key,
Object value)
Verifies that the actual
PropertyContainer has the given property key with the given valueExample: GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); ResourceIterator<String> loveLevelIterator = myExecutionEngine.execute( "MATCH (:CHARACTER)-[l:LOVES]->(:DOUGHNUT) RETURN l.level AS level").columnAs("level"); assertThat(loveLevelIterator).hasSize(3); If the given size is negative, an IllegalArgumentException is thrown. |
A |
hasPropertyKey(String key)
Verifies that the actual
PropertyContainer has the given property keyExample: GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node node = graph.createNode(); node.setProperty("firstName", "Homer"); assertThat(node).hasPropertyKey("firstName"); // it also works with relationships: Relationship relationship = homer.createRelationshipTo(donut, DynamicRelationshipType.withName("LOVES")); relationship.setProperty("firstName", "Homer"); assertThat(relationship).hasPropertyKey("firstName"); If the given key is null , an IllegalArgumentException is thrown. |
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
public T getActual()
public A hasPropertyKey(String key)
PropertyContainer
has the given property keyExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node node = graph.createNode(); node.setProperty("firstName", "Homer"); assertThat(node).hasPropertyKey("firstName"); // it also works with relationships: Relationship relationship = homer.createRelationshipTo(donut, DynamicRelationshipType.withName("LOVES")); relationship.setProperty("firstName", "Homer"); assertThat(relationship).hasPropertyKey("firstName");If the given
key
is null
, an IllegalArgumentException
is thrown.
key
- the property key to look for in the actual PropertyContainer
PropertyContainerAssert
for assertions chainingIllegalArgumentException
- if key
is null
.AssertionError
- if the actual PropertyContainer
does not have a property with the given key.public A hasProperty(String key, Object value)
PropertyContainer
has the given property key with the given valueExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); ResourceIterator<String> loveLevelIterator = myExecutionEngine.execute( "MATCH (:CHARACTER)-[l:LOVES]->(:DOUGHNUT) RETURN l.level AS level").columnAs("level"); assertThat(loveLevelIterator).hasSize(3);If the given
size
is negative, an IllegalArgumentException
is thrown.
key
- the property key to look for in the actual PropertyContainer
value
- the property value to look for in the actual PropertyContainer
PropertyContainerAssert
for assertions chainingIllegalArgumentException
- if key
is null
.IllegalArgumentException
- if value
is null
.AssertionError
- if the actual PropertyContainer
does not have a property with given key and value.public A doesNotHavePropertyKey(String key)
PropertyContainer
does not have the given property keyExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node node = graph.createNode(); node.setProperty("firstName", "Homer"); assertThat(node).doesNotHavePropertyKey("lastName"); // it also works with relationships: Relationship relationship = homer.createRelationshipTo(donut, DynamicRelationshipType.withName("LOVES")); relationship.setProperty("firstName", "Homer"); assertThat(relationship).doesNotHavePropertyKey("lastName");If the
key
is null
, an IllegalArgumentException
is thrown.
key
- the property key to look for in the actual PropertyContainer
PropertyContainerAssert
for assertions chainingIllegalArgumentException
- if key
is null
.AssertionError
- if the actual PropertyContainer
has a property with given key.public A doesNotHaveProperty(String key, Object value)
PropertyContainer
does not have a property with given key and value.Example:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase(); Node node = graph.createNode(); node.setProperty("firstName", "Homer"); assertThat(node).doesNotHaveProperty("firstName", "Bart"); assertThat(node).doesNotHaveProperty("lastName", "Homer"); // it also works with relationships: Relationship relationship = homer.createRelationshipTo(donut, DynamicRelationshipType.withName("LOVES")); relationship.setProperty("firstName", "Homer"); assertThat(relationship).doesNotHaveProperty("firstName", "Bart"); assertThat(relationship).doesNotHaveProperty("lastName", "Homer");If any of the
key
or value
is null
, an IllegalArgumentException
is
thrown.
key
- the property key to look for in the actual PropertyContainer
value
- the property value to look for in the actual PropertyContainer
PropertyContainerAssert
for assertions chainingIllegalArgumentException
- if key
is null
.IllegalArgumentException
- if value
is null
.AssertionError
- if the actual PropertyContainer
has a property with given key and value.Copyright © 2017 AssertJ. All rights reserved.