1
1
/**
2
- * Copyright 2009-2017 the original author or authors.
2
+ * Copyright 2009-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
41
41
42
42
public class ScriptRunnerTest extends BaseDataTest {
43
43
44
+ private static final String LINE_SEPARATOR = System .getProperty ("line.separator" , "\n " );
45
+
44
46
@ Test
45
47
@ Ignore ("This fails with HSQLDB 2.0 due to the create index statements in the schema script" )
46
48
public void shouldRunScriptsBySendingFullScriptAtOnce () throws Exception {
@@ -198,9 +200,9 @@ public void testLogging() throws Exception {
198
200
conn .close ();
199
201
200
202
assertEquals (
201
- "select userid from account where userid = 'j2ee'" + System . getProperty ( "line.separator" )
202
- + System . getProperty ( "line.separator" ) + "USERID\t " + System . getProperty ( "line.separator" )
203
- + "j2ee\t " + System . getProperty ( "line.separator" ) , sw .toString ());
203
+ "select userid from account where userid = 'j2ee'" + LINE_SEPARATOR
204
+ + LINE_SEPARATOR + "USERID\t " + LINE_SEPARATOR
205
+ + "j2ee\t " + LINE_SEPARATOR , sw .toString ());
204
206
}
205
207
206
208
@ Test
@@ -221,9 +223,9 @@ public void testLoggingFullScipt() throws Exception {
221
223
conn .close ();
222
224
223
225
assertEquals (
224
- "select userid from account where userid = 'j2ee';" + System . getProperty ( "line.separator" )
225
- + System . getProperty ( "line.separator" ) + "USERID\t " + System . getProperty ( "line.separator" )
226
- + "j2ee\t " + System . getProperty ( "line.separator" ) , sw .toString ());
226
+ "select userid from account where userid = 'j2ee';" + LINE_SEPARATOR
227
+ + LINE_SEPARATOR + "USERID\t " + LINE_SEPARATOR
228
+ + "j2ee\t " + LINE_SEPARATOR , sw .toString ());
227
229
}
228
230
229
231
private void runJPetStoreScripts (ScriptRunner runner ) throws IOException , SQLException {
@@ -264,10 +266,10 @@ public void shouldAcceptDelimiterVariations() throws Exception {
264
266
Reader reader = new StringReader (sql );
265
267
runner .runScript (reader );
266
268
267
- verify (stmt , Mockito .times (1 )).execute (eq ("line 1;\n " + "line 2;\n \n " ));
268
- verify (stmt , Mockito .times (1 )).execute (eq ("line 3\n " ));
269
- verify (stmt , Mockito .times (1 )).execute (eq ("line 4\n " ));
270
- verify (stmt , Mockito .times (1 )).execute (eq ("line 5\n " ));
269
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR ));
270
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 3" + LINE_SEPARATOR ));
271
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 4" + LINE_SEPARATOR ));
272
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 5" + LINE_SEPARATOR ));
271
273
}
272
274
273
275
@ Test
@@ -298,7 +300,7 @@ public void shouldAcceptMultiCharDelimiter() throws Exception {
298
300
Reader reader = new StringReader (sql );
299
301
runner .runScript (reader );
300
302
301
- verify (stmt , Mockito .times (1 )).execute (eq ("line 1;\n " + "line 2;\n \n " ));
302
- verify (stmt , Mockito .times (1 )).execute (eq ("line 3\n " ));
303
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR ));
304
+ verify (stmt , Mockito .times (1 )).execute (eq ("line 3" + LINE_SEPARATOR ));
303
305
}
304
306
}
0 commit comments