public class PathAssert
extends org.assertj.core.api.IterableAssert<org.neo4j.graphdb.PropertyContainer>
Path| Modifier | Constructor and Description |
|---|---|
protected |
PathAssert(org.neo4j.graphdb.Path actual) |
| Modifier and Type | Method and Description |
|---|---|
PathAssert |
doesNotEndWithNode(org.neo4j.graphdb.Node node)
Verifies that the given node is not the last one of the actual
Path |
PathAssert |
doesNotEndWithRelationship(org.neo4j.graphdb.Relationship relationship)
Verifies that the given relationship is not the last one of the actual
Path |
PathAssert |
doesNotStartWithNode(org.neo4j.graphdb.Node node)
Verifies that the actual
Path does not start with the given node |
PathAssert |
endsWithNode(org.neo4j.graphdb.Node node)
Verifies that the actual
Path ends with the given node |
PathAssert |
endsWithRelationship(org.neo4j.graphdb.Relationship relationship)
Verifies that the given relationship is the last one of the actual
Path |
org.neo4j.graphdb.Path |
getActual() |
PathAssert |
hasLength(int length)
Verifies that the path length equals the given one
|
PathAssert |
startsWithNode(org.neo4j.graphdb.Node node)
Verifies that the actual
Path starts with the given node |
contains, containsExactly, containsExactlyInAnyOrder, containsOnly, containsOnlyOnce, containsSequence, containsSubsequence, doesNotContain, doesNotContainSequence, doesNotContainSubsequence, endsWith, isEqualTo, isExactlyInstanceOf, isInstanceOf, isInstanceOfAny, isNotExactlyInstanceOf, isNotInstanceOf, isNotInstanceOfAny, isNotOfAnyClassIn, isNotSameAs, isOfAnyClassIn, isSameAs, isSubsetOf, startsWithallMatch, allMatch, allSatisfy, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, containsAll, containsExactlyElementsOf, containsNull, containsOnlyElementsOf, containsSequence, containsSubsequence, describedAs, describedAs, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSubsequence, doesNotHave, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isIn, isIn, isNot, isNotEmpty, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNullOrEmpty, isSubsetOf, last, navigationDescription, newListAssertInstance, overridingErrorMessage, size, toLazyIterable, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnErrorpublic org.neo4j.graphdb.Path getActual()
public PathAssert startsWithNode(org.neo4j.graphdb.Node node)
Path starts with the given nodeExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).startsWithNode(homerNode);
If the node is null, an IllegalArgumentException is thrown.
node - the expected start node of the actual PathPathAssert for assertions chainingIllegalArgumentException - if node is null.AssertionError - if the actual Path does not start with the given nodepublic PathAssert doesNotStartWithNode(org.neo4j.graphdb.Node node)
Path does not start with the given nodeExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// [...]
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).doesNotStartWithNode(healthyPersonNode);
If the node is null, an IllegalArgumentException is thrown.
node - the expected start node of the actual PathPathAssert for assertions chainingIllegalArgumentException - if node is null.AssertionError - if the actual Path starts with the given nodepublic PathAssert endsWithNode(org.neo4j.graphdb.Node node)
Path ends with the given nodeExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).endsWithNode(doughnutNode);
If the node is null, an IllegalArgumentException is thrown.
node - the expected end node of the actual PathPathAssert for assertions chainingIllegalArgumentException - if node is null.AssertionError - if the actual Path does not end with the given nodepublic PathAssert doesNotEndWithNode(org.neo4j.graphdb.Node node)
PathExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).doesNotEndWithNode(saladNode);
If the node is null, an IllegalArgumentException is thrown.
node - the expected last node of the actual PathPathAssert for assertions chainingIllegalArgumentException - if node is null.AssertionError - if the actual Path ends with this nodepublic PathAssert endsWithRelationship(org.neo4j.graphdb.Relationship relationship)
PathExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).endsWithRelationship(love);
If the node is null, an IllegalArgumentException is thrown.
relationship - the expected last relationship of the actual PathPathAssert for assertions chainingIllegalArgumentException - if relationship is null.AssertionError - if the actual Path does not contain this relationship lastpublic PathAssert doesNotEndWithRelationship(org.neo4j.graphdb.Relationship relationship)
PathExample:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).doesNotEndWithRelationship(hate);
If the node is null, an IllegalArgumentException is thrown.
relationship - the expected last relationship of the actual PathPathAssert for assertions chainingIllegalArgumentException - if relationship is null.AssertionError - if the actual Path ends with this relationshippublic PathAssert hasLength(int length)
Example:
GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
// [...]
Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName("LOVES"));
// PathExpander bellyExpander = [...]
Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
assertThat(homerToDoughnutPath).hasLength(1);
If the length is strictly negative, an IllegalArgumentException is thrown.
length - the expected length of the PathPathAssert for assertions chainingIllegalArgumentException - if length is strictly negative.AssertionError - if the actual Path has a different lengthCopyright © 2017 AssertJ. All rights reserved.