File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
src/test/java/com/flowingcode/vaadin/addons/demo/it Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,17 @@ public AbstractSourceCodeViewerIT() {
3636 super (null );
3737 }
3838
39- protected void open (String resource , String ... args ) {
39+ private String getResourceName () {
40+ String method = new Throwable ().getStackTrace ()[2 ].getMethodName ();
41+ return method .replaceFirst ("^test" , "" );
42+ }
43+
44+ protected void open (String ... args ) {
45+ String resource = getResourceName ();
46+
4047 if (viewer != null ) {
4148 throw new IllegalStateException ();
4249 }
43- expected = getExpectedText (resource );
4450
4551 String path = "com/flowingcode/vaadin/addons/demo/it/" + resource ;
4652 String params = Stream .of (args ).map (Object ::toString ).collect (Collectors .joining (";" ));
@@ -62,7 +68,7 @@ private String getExpectedText(String resource) {
6268 }
6369
6470 protected final String expected () {
65- return expected ;
71+ return getExpectedText ( getResourceName ()) ;
6672 }
6773
6874 protected String getText () {
Original file line number Diff line number Diff line change @@ -26,37 +26,37 @@ public class SourceCodeViewerIT extends AbstractSourceCodeViewerIT {
2626
2727 @ Test
2828 public void testSimpleSource () {
29- open ("SimpleSource" );
29+ open ();
3030 assertEquals (expected (), getText ());
3131 }
3232
3333 @ Test
3434 public void testHideSource () {
35- open ("HideSource" );
35+ open ();
3636 assertEquals (expected (), getText ());
3737 }
3838
3939 @ Test
4040 public void testShowSource () {
41- open ("ShowSource" );
41+ open ();
4242 assertEquals (expected (), getText ());
4343 }
4444
4545 @ Test
4646 public void testPackageCleanup () {
47- open ("PackageCleanup" );
47+ open ();
4848 assertEquals (expected (), getText ());
4949 }
5050
5151 @ Test
5252 public void testAnnotationCleanup () {
53- open ("AnnotationCleanup" );
53+ open ();
5454 assertEquals (expected (), getText ());
5555 }
5656
5757 @ Test
5858 public void testLicenseCleanup () {
59- open ("LicenseCleanup" );
59+ open ();
6060 assertEquals (expected (), getText ());
6161 }
6262
You can’t perform that action at this time.
0 commit comments