File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
main/java/de/donnerbart/split
test/java/de/donnerbart/split Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,12 @@ public void run() throws Exception {
6464 LOG .info ("Working directory: {}" , workingDirectory );
6565 final var testPaths = getPaths (workingDirectory , glob , excludeGlob );
6666 final var classNames = fileToClassName (testPaths , exitCodeConsumer );
67- LOG .info ("Found {} test classes" , classNames .size ());
67+ if (classNames .isEmpty ()) {
68+ LOG .error ("Found no test classes" );
69+ exitCodeConsumer .accept (1 );
70+ } else {
71+ LOG .info ("Found {} test classes" , classNames .size ());
72+ }
6873
6974 final var testCases = new HashSet <TestCase >();
7075 if (junitGlob != null ) {
Original file line number Diff line number Diff line change @@ -133,6 +133,24 @@ void run_withJUnit_secondSplit() throws Exception {
133133 assertThat (exitCode ).hasNullValue ();
134134 }
135135
136+ @ Test
137+ void run_noTests () throws Exception {
138+ final var projectFolder = tmp .resolve ("no-tests-project" ).resolve ("src" ).resolve ("main" ).resolve ("java" );
139+
140+ final var testSplit = new TestSplit (0 ,
141+ 1 ,
142+ "**/no-tests-project/**/*Test.java" ,
143+ null ,
144+ null ,
145+ projectFolder ,
146+ true ,
147+ exitCode ::set );
148+ testSplit .run ();
149+
150+ assertThat (systemOut .getLinesNormalized ()).isEmpty ();
151+ assertThat (exitCode ).hasValue (1 );
152+ }
153+
136154 @ Test
137155 void run_noPackage () throws Exception {
138156 final var projectFolder = tmp .resolve ("no-package-project" ).resolve ("src" ).resolve ("main" ).resolve ("java" );
You can’t perform that action at this time.
0 commit comments