Skip to content

Commit

Permalink
Fixes an assumption in ErrorMessagesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Sep 4, 2017
1 parent b7ecb4a commit bd724c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -38,7 +39,6 @@
import org.neo4j.test.rule.ImpermanentDatabaseRule;

import static org.hamcrest.Matchers.any;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
Expand All @@ -59,7 +59,7 @@ public void shouldNotifyWhenUsingCypher3_1ForTheRulePlannerWhenCypherVersionIsTh
InputPosition position = new InputPosition( 20, 1, 21 );

// then
assertThat( result.getNotifications(), contains( RULE_PLANNER_UNAVAILABLE_FALLBACK.notification( position ) ) );
assertThat( result.getNotifications(), Matchers.<Notification>contains( RULE_PLANNER_UNAVAILABLE_FALLBACK.notification( position ) ) );
Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
assertThat( arguments.get( "planner" ), equalTo( "RULE" ) );
Expand All @@ -74,7 +74,7 @@ public void shouldNotifyWhenUsingCypher3_1ForTheRulePlannerWhenCypherVersionIs3_
InputPosition position = new InputPosition( 24, 1, 25 );

// then
assertThat( result.getNotifications(), contains( RULE_PLANNER_UNAVAILABLE_FALLBACK.notification( position ) ) );
assertThat( result.getNotifications(), Matchers.<Notification>contains( RULE_PLANNER_UNAVAILABLE_FALLBACK.notification( position ) ) );
Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
assertThat( arguments.get( "planner" ), equalTo( "RULE" ) );
Expand Down Expand Up @@ -106,7 +106,7 @@ public void shouldNotifyWhenUsingCreateUniqueWhenCypherVersionIsDefault() throws
InputPosition position = new InputPosition( 25, 1, 26 );

// then
assertThat( result.getNotifications(), contains( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
assertThat( result.getNotifications(), Matchers.<Notification>contains( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
result.close();
Expand All @@ -120,7 +120,7 @@ public void shouldNotifyWhenUsingCreateUniqueWhenCypherVersionIs3_2() throws Exc
InputPosition position = new InputPosition( 36, 1, 37 );

// then
assertThat( result.getNotifications(), contains( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
assertThat( result.getNotifications(), Matchers.<Notification>contains( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
result.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ class ErrorMessagesTest extends ExecutionEngineFunSuite with CypherSerializer {
}

test("trying to add unique constraint when duplicates exist") {
createLabeledNode(Map("name" -> "A"), "Person")
createLabeledNode(Map("name" -> "A"), "Person")
val node1 = createLabeledNode(Map("name" -> "A"), "Person").getId
val node2 = createLabeledNode(Map("name" -> "A"), "Person").getId

expectError(
"CREATE CONSTRAINT ON (person:Person) ASSERT person.name IS UNIQUE",
String.format("Unable to create CONSTRAINT ON ( person:Person ) ASSERT person.name IS UNIQUE:%n" +
"Both Node(0) and Node(1) have the label `Person` and property `name` = 'A'")
"Both Node(" + node1 + ") and Node(" + node2 + ") have the label `Person` and property `name` = 'A'")
)
}

Expand Down

0 comments on commit bd724c1

Please sign in to comment.