diff --git a/build.gradle b/build.gradle index 133671ec..c9c01c3f 100644 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,6 @@ ext { neo4jJavaVersion = '1.6.1' findbugsVersion = '3.0.0' jansiVersion = '1.13' - jlineVersion = '2.14.2' + jlineVersion = '2.14.6' mockitoVersion = '1.9.5' } diff --git a/cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java b/cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java index 89ff7f7f..400b42d9 100644 --- a/cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java +++ b/cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java @@ -19,7 +19,7 @@ public class MainIntegrationTest { public void connectInteractivelyPromptsOnWrongAuthentication() throws Exception { // given // what the user inputs when prompted - String inputString = "neo4j\nneo\n"; + String inputString = String.format( "neo4j%nneo%n" ); InputStream inputStream = new ByteArrayInputStream(inputString.getBytes()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -58,7 +58,6 @@ public void connectInteractivelyPromptsOnWrongAuthentication() throws Exception assertEquals("neo", connectionConfig.password()); String out = baos.toString(); - assertEquals( "username: neo4j\r\n" + - "password: ***\r\n", out ); + assertEquals( String.format( "username: neo4j%npassword: ***%n" ), out ); } } diff --git a/cypher-shell/src/test/java/org/neo4j/shell/MainTest.java b/cypher-shell/src/test/java/org/neo4j/shell/MainTest.java index db0d471e..89a1868d 100644 --- a/cypher-shell/src/test/java/org/neo4j/shell/MainTest.java +++ b/cypher-shell/src/test/java/org/neo4j/shell/MainTest.java @@ -88,7 +88,7 @@ public void connectMaybeInteractivelyPromptsForBothIfNone() throws Exception { String out = new String(baos.toByteArray(), StandardCharsets.UTF_8); - assertEquals(out, "username: bob\r\npassword: ******\r\n"); + assertEquals( out, String.format( "username: bob%npassword: ******%n" )); verify(connectionConfig).setUsername("bob"); verify(connectionConfig).setPassword("secret"); verify(shell, times(2)).connect(connectionConfig); @@ -130,7 +130,7 @@ public void connectMaybeInteractivelyPromptsForUserIfPassExists() throws Excepti String out = new String(baos.toByteArray(), StandardCharsets.UTF_8); - assertEquals(out, "username: bob\r\n"); + assertEquals(out, String.format( "username: bob%n" )); verify(connectionConfig).setUsername("bob"); verify(shell, times(2)).connect(connectionConfig); } @@ -151,7 +151,7 @@ public void connectMaybeInteractivelyPromptsForPassIfUserExists() throws Excepti String out = new String(baos.toByteArray(), StandardCharsets.UTF_8); - assertEquals(out, "password: ******\r\n"); + assertEquals(out, String.format("password: ******%n")); verify(connectionConfig).setPassword("secret"); verify(shell, times(2)).connect(connectionConfig); } @@ -171,7 +171,7 @@ public void connectMaybeInteractivelyPromptsHandlesBang() throws Exception { String out = new String(baos.toByteArray(), StandardCharsets.UTF_8); - assertEquals(out, "username: bo!b\r\npassword: *******\r\n"); + assertEquals(out, String.format("username: bo!b%npassword: *******%n")); verify(connectionConfig).setUsername("bo!b"); verify(connectionConfig).setPassword("sec!ret"); verify(shell, times(2)).connect(connectionConfig); @@ -214,8 +214,7 @@ public void connectMaybeInteractivelyRepromptsIfUserIsNotProvided() throws Excep String out = new String(baos.toByteArray(), StandardCharsets.UTF_8); - assertEquals(out, "username: \r\nusername cannot be empty" + System.lineSeparator() + System.lineSeparator() + - "username: bob\r\npassword: ******\r\n"); + assertEquals(out, String.format( "username: %nusername cannot be empty%n%nusername: bob%npassword: ******%n") ); verify(connectionConfig).setUsername("bob"); verify(connectionConfig).setPassword("secret"); verify(shell, times(2)).connect(connectionConfig);