File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
main/java/org/opengrok/indexer/configuration
test/java/org/opengrok/indexer/configuration Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,15 @@ public static String getSamples() throws RuntimeException {
9292 mthd );
9393 }
9494
95+ String propertyName = mthd .getName ().replaceFirst ("^set" , "" );
96+
9597 sample = conf .getXMLRepresentationAsString ();
9698 sample = sample .replaceFirst (
9799 "(?sx)^<\\ ?xml.*Configuration\\ d*\" >\\ n" , "" );
98100 sample = sample .replaceFirst ("</object>\\ n</java>" , "" );
101+ // With Java 11 the following excision is necessary.
102+ sample = sample .replaceFirst ("(?isx)^.*\\ n(?=\\ s*<void\\ s+property=\" " +
103+ propertyName + "\" )" , "" );
99104
100105 h .clear ();
101106 h .append (XML_COMMENT_START );
Original file line number Diff line number Diff line change 1818 */
1919
2020/*
21- * Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
21+ * Copyright (c) 2018, 2020, Chris Fraire <cfraire@me.com>.
2222 */
2323
2424package org .opengrok .indexer .configuration ;
2525
26+ import static org .junit .Assert .assertFalse ;
2627import static org .junit .Assert .assertTrue ;
2728import org .junit .Test ;
2829
@@ -33,9 +34,12 @@ public class ConfigurationHelpTest {
3334 @ Test
3435 public void shouldCreateReadableUsage () {
3536 String samples = ConfigurationHelp .getSamples ();
36- assertTrue ("samples are not empty" , ! samples .isEmpty ());
37+ assertFalse ("samples are not empty" , samples .isEmpty ());
3738 assertTrue ("samples contains \" <?\" " , samples .contains ("<?" ));
3839 assertTrue ("samples contains \" user-defined\" " ,
3940 samples .contains ("user-defined" ));
41+ assertTrue ("Java 11 nulls are removed" ,
42+ samples .contains ("<!-- Sample for setWebappCtags. Default is false -->\n " +
43+ " <void property=\" webappCtags\" >\n " ));
4044 }
4145}
You can’t perform that action at this time.
0 commit comments