1
1
package org .testcontainers .ext ;
2
2
3
- import org .junit .Test ;
3
+ import org .junit .jupiter . api . Test ;
4
4
5
5
import java .util .ArrayList ;
6
6
import java .util .Arrays ;
10
10
import static org .assertj .core .api .Assertions .assertThat ;
11
11
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
12
12
13
- public class ScriptSplittingTest {
13
+ class ScriptSplittingTest {
14
14
15
15
@ Test
16
- public void testStringDemarcation () {
16
+ void testStringDemarcation () {
17
17
String script = "SELECT 'foo `bar`'; SELECT 'foo -- `bar`'; SELECT 'foo /* `bar`';" ;
18
18
19
19
List <String > expected = Arrays .asList ("SELECT 'foo `bar`'" , "SELECT 'foo -- `bar`'" , "SELECT 'foo /* `bar`'" );
@@ -22,7 +22,7 @@ public void testStringDemarcation() {
22
22
}
23
23
24
24
@ Test
25
- public void testIssue1547Case1 () {
25
+ void testIssue1547Case1 () {
26
26
String script =
27
27
"create database if not exists ttt;\n " +
28
28
"\n " +
@@ -51,7 +51,7 @@ public void testIssue1547Case1() {
51
51
}
52
52
53
53
@ Test
54
- public void testIssue1547Case2 () {
54
+ void testIssue1547Case2 () {
55
55
String script =
56
56
"CREATE TABLE bar (\n " +
57
57
" end_time VARCHAR(255)\n " +
@@ -69,7 +69,7 @@ public void testIssue1547Case2() {
69
69
}
70
70
71
71
@ Test
72
- public void testSplittingEnquotedSemicolon () {
72
+ void testSplittingEnquotedSemicolon () {
73
73
String script = "CREATE TABLE `bar;bar` (\n " + " end_time VARCHAR(255)\n " + ");" ;
74
74
75
75
List <String > expected = Arrays .asList ("CREATE TABLE `bar;bar` ( end_time VARCHAR(255) )" );
@@ -78,7 +78,7 @@ public void testSplittingEnquotedSemicolon() {
78
78
}
79
79
80
80
@ Test
81
- public void testUnusualSemicolonPlacement () {
81
+ void testUnusualSemicolonPlacement () {
82
82
String script = "SELECT 1;;;;;SELECT 2;\n ;SELECT 3\n ; SELECT 4;\n SELECT 5" ;
83
83
84
84
List <String > expected = Arrays .asList ("SELECT 1" , "SELECT 2" , "SELECT 3" , "SELECT 4" , "SELECT 5" );
@@ -87,7 +87,7 @@ public void testUnusualSemicolonPlacement() {
87
87
}
88
88
89
89
@ Test
90
- public void testCommentedSemicolon () {
90
+ void testCommentedSemicolon () {
91
91
String script =
92
92
"CREATE TABLE bar (\n " + " foo VARCHAR(255)\n " + "); \n DROP PROCEDURE IF EXISTS -- ;\n " + " count_foo" ;
93
93
@@ -100,7 +100,7 @@ public void testCommentedSemicolon() {
100
100
}
101
101
102
102
@ Test
103
- public void testStringEscaping () {
103
+ void testStringEscaping () {
104
104
String script =
105
105
"SELECT \" a /* string literal containing comment characters like -- here\" ;\n " +
106
106
"SELECT \" a 'quoting' \\ \" scenario ` involving BEGIN keyword\\ \" here\" ;\n " +
@@ -116,7 +116,7 @@ public void testStringEscaping() {
116
116
}
117
117
118
118
@ Test
119
- public void testBlockCommentExclusion () {
119
+ void testBlockCommentExclusion () {
120
120
String script = "INSERT INTO bar (foo) /* ; */ VALUES ('hello world');" ;
121
121
122
122
List <String > expected = Arrays .asList ("INSERT INTO bar (foo) VALUES ('hello world')" );
@@ -125,7 +125,7 @@ public void testBlockCommentExclusion() {
125
125
}
126
126
127
127
@ Test
128
- public void testBeginEndKeywordCorrectDetection () {
128
+ void testBeginEndKeywordCorrectDetection () {
129
129
String script =
130
130
"INSERT INTO something_end (begin_with_the_token, another_field) /*end*/ VALUES /* end */ (' begin ', `end`)-- begin\n ;" ;
131
131
@@ -137,7 +137,7 @@ public void testBeginEndKeywordCorrectDetection() {
137
137
}
138
138
139
139
@ Test
140
- public void testCommentInStrings () {
140
+ void testCommentInStrings () {
141
141
String script =
142
142
"CREATE TABLE bar (foo VARCHAR(255));\n " +
143
143
"\n " +
@@ -161,7 +161,7 @@ public void testCommentInStrings() {
161
161
}
162
162
163
163
@ Test
164
- public void testMultipleBeginEndDetection () {
164
+ void testMultipleBeginEndDetection () {
165
165
String script =
166
166
"CREATE TABLE bar (foo VARCHAR(255));\n " +
167
167
"\n " +
@@ -205,7 +205,7 @@ public void testMultipleBeginEndDetection() {
205
205
}
206
206
207
207
@ Test
208
- public void testProcedureBlock () {
208
+ void testProcedureBlock () {
209
209
String script =
210
210
"CREATE PROCEDURE count_foo()\n " +
211
211
" BEGIN\n " +
@@ -264,15 +264,15 @@ public void testProcedureBlock() {
264
264
}
265
265
266
266
@ Test
267
- public void testUnclosedBlockComment () {
267
+ void testUnclosedBlockComment () {
268
268
String script = "SELECT 'foo `bar`'; /*" ;
269
269
assertThatThrownBy (() -> doSplit (script , ScriptUtils .DEFAULT_STATEMENT_SEPARATOR ))
270
270
.isInstanceOf (ScriptUtils .ScriptParseException .class )
271
271
.hasMessageContaining ("*/" );
272
272
}
273
273
274
274
@ Test
275
- public void testIssue1452Case () {
275
+ void testIssue1452Case () {
276
276
String script =
277
277
"create table test (text VARCHAR(255));\n " +
278
278
"\n " +
@@ -288,7 +288,7 @@ public void testIssue1452Case() {
288
288
}
289
289
290
290
@ Test
291
- public void testIfLoopBlocks () {
291
+ void testIfLoopBlocks () {
292
292
String script =
293
293
"BEGIN\n " +
294
294
" rec_loop: LOOP\n " +
@@ -310,7 +310,7 @@ public void testIfLoopBlocks() {
310
310
}
311
311
312
312
@ Test
313
- public void testIfLoopBlocksSpecificSeparator () {
313
+ void testIfLoopBlocksSpecificSeparator () {
314
314
String script =
315
315
"BEGIN\n " +
316
316
" rec_loop: LOOP\n " +
@@ -336,14 +336,14 @@ public void testIfLoopBlocksSpecificSeparator() {
336
336
}
337
337
338
338
@ Test
339
- public void oracleStyleBlocks () {
339
+ void oracleStyleBlocks () {
340
340
String script = "BEGIN END; /\n " + "BEGIN END;" ;
341
341
List <String > expected = Arrays .asList ("BEGIN END;" , "BEGIN END;" );
342
342
splitAndCompare (script , expected , "/" );
343
343
}
344
344
345
345
@ Test
346
- public void testMultiProcedureMySQLScript () {
346
+ void testMultiProcedureMySQLScript () {
347
347
String script =
348
348
"CREATE PROCEDURE doiterate(p1 INT)\n " +
349
349
" BEGIN\n " +
@@ -398,7 +398,7 @@ public void testMultiProcedureMySQLScript() {
398
398
}
399
399
400
400
@ Test
401
- public void testDollarQuotedStrings () {
401
+ void testDollarQuotedStrings () {
402
402
String script =
403
403
"CREATE FUNCTION f ()\n " +
404
404
"RETURNS INT\n " +
@@ -418,7 +418,7 @@ public void testDollarQuotedStrings() {
418
418
}
419
419
420
420
@ Test
421
- public void testNestedDollarQuotedString () {
421
+ void testNestedDollarQuotedString () {
422
422
//see https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING
423
423
String script =
424
424
"CREATE FUNCTION f() AS $function$\n " +
@@ -439,7 +439,7 @@ public void testNestedDollarQuotedString() {
439
439
}
440
440
441
441
@ Test
442
- public void testUnclosedDollarQuotedString () {
442
+ void testUnclosedDollarQuotedString () {
443
443
String script = "SELECT $tag$ ..... $" ;
444
444
assertThatThrownBy (() -> doSplit (script , ScriptUtils .DEFAULT_STATEMENT_SEPARATOR ))
445
445
.isInstanceOf (ScriptUtils .ScriptParseException .class )
@@ -470,12 +470,12 @@ private List<String> doSplit(String script, String separator) {
470
470
}
471
471
472
472
@ Test
473
- public void testIgnoreDelimitersInLiteralsAndComments () {
473
+ void testIgnoreDelimitersInLiteralsAndComments () {
474
474
assertThat (ScriptUtils .containsSqlScriptDelimiters ("'@' /*@*/ \" @\" $tag$@$tag$ --@" , "@" )).isFalse ();
475
475
}
476
476
477
477
@ Test
478
- public void testContainsDelimiters () {
478
+ void testContainsDelimiters () {
479
479
assertThat (ScriptUtils .containsSqlScriptDelimiters ("'@' /*@*/ @ \" @\" --@" , "@" )).isTrue ();
480
480
}
481
481
}
0 commit comments