Skip to content

Commit 427d698

Browse files
committed
Internal refactoring
1 parent 0cafe22 commit 427d698

2 files changed

Lines changed: 61 additions & 60 deletions

File tree

src/conf/checkstyle-suppressions.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<suppress checks="MethodName" files="src[/\\]test[/\\]java[/\\]" />
2929
<suppress checks="MagicNumber" files="src[/\\]test[/\\]java[/\\]" />
3030
<suppress checks="ParameterNumber" files="src[/\\]test[/\\]java[/\\]" />
31-
<suppress checks="MethodLength" files="BugCLI162Test.java" />
3231

3332
<!-- Suppress visibility check of some member fields as they have to be kept
3433
for binary compatibility reasons -->

src/test/java/org/apache/commons/cli/bug/BugCLI162Test.java

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,66 @@ public class BugCLI162Test {
108108

109109
private StringWriter sw;
110110

111+
// @formatter:off
112+
private static final String EXPECTED = "usage: org.apache.commons.cli.bug.BugCLI162Test" + CR +
113+
" -2,--jdbc2sfmd <arg> Converts the JDBC file in the first argument" + CR +
114+
" to an SMFD file specified in the second" + CR +
115+
" argument." + CR +
116+
" -a,--paramNames <arg> Parameter XML names; default names are" + CR +
117+
" param1, param2, etc. Example: -a \"pname1" + CR +
118+
" pname2\"" + CR +
119+
" -b,--jdbc <arg> Writes a JDBC binding node file for the given" + CR +
120+
" SQL" + CR +
121+
" -c,--url <arg> Connection URL" + CR +
122+
" -d,--driver <arg> JDBC driver class name" + CR +
123+
" -e,--description <arg> SFMD description. A default description is" + CR +
124+
" used if omited. Example: -e \"Runs such and" + CR +
125+
" such\"" + CR +
126+
" -f,--sfmd <arg> Writes a SFMD file for the given SQL" + CR +
127+
" -g,--printTiming Prints timing information" + CR +
128+
" -h,--help Prints help and quits" + CR +
129+
" -i,--interactive Runs in interactive mode, reading and writing" + CR +
130+
" from the console, 'go' or '/' sends a" + CR +
131+
" statement" + CR +
132+
" -j,--node <arg> Writes a JDBC node file for the given SQL" + CR +
133+
" (internal debugging)" + CR +
134+
" -l,--columnNames <arg> Column XML names; default names column" + CR +
135+
" labels. Example: -l \"cname1 cname2\"" + CR +
136+
" -m,--printMetaData Prints metadata information" + CR +
137+
" -n,--info Prints driver information and properties. If" + CR +
138+
" -c is not specified, all drivers on the" + CR +
139+
" classpath are displayed." + CR +
140+
" -o,--paramModes <arg> Parameters modes (1=IN, 2=INOUT, 4=OUT," + CR +
141+
" 0=Unknown). -o and -O are mutually exclusive." + CR +
142+
" Example for 2 parameters, OUT and IN: -o \"4" + CR +
143+
" 1\"" + CR +
144+
" -O,--paramModeNames <arg> Parameters mode names (IN, INOUT, OUT," + CR +
145+
" Unknown). -o and -O are mutually exclusive." + CR +
146+
" Example for 2 parameters, OUT and IN: -O \"OUT" + CR +
147+
" IN\"" + CR +
148+
" -p,--password <arg> The database password for the user specified" + CR +
149+
" with the -u option. You can obfuscate the" + CR +
150+
" password with" + CR +
151+
" org.mortbay.jetty.security.Password, see" + CR +
152+
" https://docs.codehaus.org/display/JETTY/Secur" + CR +
153+
" ing+Passwords" + CR +
154+
" -s,--sql <arg> Runs SQL or {call stored_procedure(?, ?)} or" + CR +
155+
" {?=call function(?, ?)}" + CR +
156+
" -t,--printStack Prints stack traces on errors" + CR +
157+
" --trim <arg> Trims leading and trailing spaces from all" + CR +
158+
" column values. Column XML names can be" + CR +
159+
" optionally specified to set which columns to" + CR +
160+
" trim." + CR +
161+
" -u,--user <arg> A database user name" + CR +
162+
" -w,--outfile <arg> Writes the SQL output to the given file" + CR +
163+
" -y,--paramTypes <arg> Parameter types from java.sql.Types. -y and" + CR +
164+
" -Y are mutually exclusive. Example: -y \"-10" + CR +
165+
" 12\"" + CR +
166+
" -Y,--paramTypeNames <arg> Parameter java.sql.Types names. -y and -Y are" + CR +
167+
" mutually exclusive. Example: -Y \"CURSOR" + CR +
168+
" VARCHAR\"" + CR;
169+
// @formatter:on
170+
111171
@BeforeEach
112172
public void setUp() {
113173
formatter = new HelpFormatter();
@@ -319,66 +379,8 @@ public void testPrintHelpLongLines() {
319379

320380
formatter.printHelp(new PrintWriter(sw), HelpFormatter.DEFAULT_WIDTH, this.getClass().getName(), null, commandLineOptions,
321381
HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null);
322-
//@formatter:off
323-
final String expected = "usage: org.apache.commons.cli.bug.BugCLI162Test" + CR +
324-
" -2,--jdbc2sfmd <arg> Converts the JDBC file in the first argument" + CR +
325-
" to an SMFD file specified in the second" + CR +
326-
" argument." + CR +
327-
" -a,--paramNames <arg> Parameter XML names; default names are" + CR +
328-
" param1, param2, etc. Example: -a \"pname1" + CR +
329-
" pname2\"" + CR +
330-
" -b,--jdbc <arg> Writes a JDBC binding node file for the given" + CR +
331-
" SQL" + CR +
332-
" -c,--url <arg> Connection URL" + CR +
333-
" -d,--driver <arg> JDBC driver class name" + CR +
334-
" -e,--description <arg> SFMD description. A default description is" + CR +
335-
" used if omited. Example: -e \"Runs such and" + CR +
336-
" such\"" + CR +
337-
" -f,--sfmd <arg> Writes a SFMD file for the given SQL" + CR +
338-
" -g,--printTiming Prints timing information" + CR +
339-
" -h,--help Prints help and quits" + CR +
340-
" -i,--interactive Runs in interactive mode, reading and writing" + CR +
341-
" from the console, 'go' or '/' sends a" + CR +
342-
" statement" + CR +
343-
" -j,--node <arg> Writes a JDBC node file for the given SQL" + CR +
344-
" (internal debugging)" + CR +
345-
" -l,--columnNames <arg> Column XML names; default names column" + CR +
346-
" labels. Example: -l \"cname1 cname2\"" + CR +
347-
" -m,--printMetaData Prints metadata information" + CR +
348-
" -n,--info Prints driver information and properties. If" + CR +
349-
" -c is not specified, all drivers on the" + CR +
350-
" classpath are displayed." + CR +
351-
" -o,--paramModes <arg> Parameters modes (1=IN, 2=INOUT, 4=OUT," + CR +
352-
" 0=Unknown). -o and -O are mutually exclusive." + CR +
353-
" Example for 2 parameters, OUT and IN: -o \"4" + CR +
354-
" 1\"" + CR +
355-
" -O,--paramModeNames <arg> Parameters mode names (IN, INOUT, OUT," + CR +
356-
" Unknown). -o and -O are mutually exclusive." + CR +
357-
" Example for 2 parameters, OUT and IN: -O \"OUT" + CR +
358-
" IN\"" + CR +
359-
" -p,--password <arg> The database password for the user specified" + CR +
360-
" with the -u option. You can obfuscate the" + CR +
361-
" password with" + CR +
362-
" org.mortbay.jetty.security.Password, see" + CR +
363-
" https://docs.codehaus.org/display/JETTY/Secur" + CR +
364-
" ing+Passwords" + CR +
365-
" -s,--sql <arg> Runs SQL or {call stored_procedure(?, ?)} or" + CR +
366-
" {?=call function(?, ?)}" + CR +
367-
" -t,--printStack Prints stack traces on errors" + CR +
368-
" --trim <arg> Trims leading and trailing spaces from all" + CR +
369-
" column values. Column XML names can be" + CR +
370-
" optionally specified to set which columns to" + CR +
371-
" trim." + CR +
372-
" -u,--user <arg> A database user name" + CR +
373-
" -w,--outfile <arg> Writes the SQL output to the given file" + CR +
374-
" -y,--paramTypes <arg> Parameter types from java.sql.Types. -y and" + CR +
375-
" -Y are mutually exclusive. Example: -y \"-10" + CR +
376-
" 12\"" + CR +
377-
" -Y,--paramTypeNames <arg> Parameter java.sql.Types names. -y and -Y are" + CR +
378-
" mutually exclusive. Example: -Y \"CURSOR" + CR +
379-
" VARCHAR\"" + CR;
380382
//@formatter:on
381-
assertEquals(expected, sw.toString());
383+
assertEquals(EXPECTED, sw.toString());
382384
}
383385

384386
}

0 commit comments

Comments
 (0)