forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't exit the JUnitRunner with number of failures because Java will …
…mod the exit code. (pantsbuild#4106) ### Problem If you have a test with 256 failures it will return success ### Solution Don't System.exit(failureCount)
- Loading branch information
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
testprojects/tests/java/org/pantsbuild/testproject/fail256/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
|
||
junit_tests(name='fail256', | ||
sources=globs('*'), | ||
dependencies=[ | ||
'3rdparty:junit' | ||
], | ||
) |
32 changes: 32 additions & 0 deletions
32
testprojects/tests/java/org/pantsbuild/testproject/fail256/Fail256Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). | ||
// Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
package org.pantsbuild.testproject.testrule; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameter; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
@RunWith(Parameterized.class) | ||
public class Fail256Test { | ||
|
||
@Parameters | ||
public static Object[] data() { | ||
Object[] parameters = new Object[256]; | ||
for (int i = 0; i < 256; i++) { | ||
parameters[i] = i; | ||
} | ||
return parameters; | ||
} | ||
|
||
@Parameter | ||
public int input; | ||
|
||
@Test | ||
public void testFails() { | ||
Assert.assertTrue(input < 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters