@@ -121,14 +121,16 @@ public void testCommandHelp() throws Exception {
121121 .and ()
122122 .build ();
123123 commandCatalog .register (registration );
124- CharSequence help = this .help .help ("first-command" ).toString ();
124+ String help = this .help .help ("first-command" ).toString ();
125+ help = removeNewLines (help );
125126 assertThat (help ).isEqualTo (sample ());
126127 }
127128
128129 @ Test
129130 public void testCommandListDefault () throws Exception {
130131 registerCommandListCommands ();
131132 String list = this .help .help (null ).toString ();
133+ list = removeNewLines (list );
132134 assertThat (list ).isEqualTo (sample ());
133135 }
134136
@@ -137,6 +139,7 @@ public void testCommandListFlat() throws Exception {
137139 registerCommandListCommands ();
138140 this .help .setShowGroups (false );
139141 String list = this .help .help (null ).toString ();
142+ list = removeNewLines (list );
140143 assertThat (list ).isEqualTo (sample ());
141144 }
142145
@@ -147,9 +150,13 @@ public void testUnknownCommand() throws Exception {
147150 }).isInstanceOf (IllegalArgumentException .class );
148151 }
149152
153+ private String removeNewLines (String str ) {
154+ return str .replace ("\r " , "" ).replace ("\n " , "" );
155+ }
156+
150157 private String sample () throws IOException {
151158 InputStream is = new ClassPathResource (HelpTests .class .getSimpleName () + "-" + testName + ".txt" , HelpTests .class ).getInputStream ();
152- return FileCopyUtils .copyToString (new InputStreamReader (is , "UTF-8" )). replace ( "&" , "" );
159+ return removeNewLines ( FileCopyUtils .copyToString (new InputStreamReader (is , "UTF-8" )));
153160 }
154161
155162 private void registerCommandListCommands () throws Exception {
0 commit comments