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 {
64
64
LOG .info ("Working directory: {}" , workingDirectory );
65
65
final var testPaths = getPaths (workingDirectory , glob , excludeGlob );
66
66
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
+ }
68
73
69
74
final var testCases = new HashSet <TestCase >();
70
75
if (junitGlob != null ) {
Original file line number Diff line number Diff line change @@ -133,6 +133,24 @@ void run_withJUnit_secondSplit() throws Exception {
133
133
assertThat (exitCode ).hasNullValue ();
134
134
}
135
135
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
+
136
154
@ Test
137
155
void run_noPackage () throws Exception {
138
156
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