-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from ashleyfrieze/RunNotifierIssues
Resolve the issues reported in #110 with bad reporting of errors
- Loading branch information
Showing
19 changed files
with
621 additions
and
113 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
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/greghaskins/spectrum/internal/FailureDetectingRunDecorator.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,49 @@ | ||
package com.greghaskins.spectrum.internal; | ||
|
||
/** | ||
* A listener to detect test failure. | ||
*/ | ||
public class FailureDetectingRunDecorator<T, F> implements RunReporting<T, F> { | ||
private boolean hasFailedYet = false; | ||
|
||
private RunReporting<T, F> decoratee; | ||
|
||
public FailureDetectingRunDecorator(RunReporting<T, F> decoratee) { | ||
this.decoratee = decoratee; | ||
} | ||
|
||
/** | ||
* Has the run failed since we've been listening. | ||
* @return whether any previous failures have been reported | ||
*/ | ||
public boolean hasFailedYet() { | ||
return hasFailedYet; | ||
} | ||
|
||
@Override | ||
public void fireTestFailure(F failure) { | ||
decoratee.fireTestFailure(failure); | ||
hasFailedYet = true; | ||
} | ||
|
||
@Override | ||
public void fireTestIgnored(T description) { | ||
decoratee.fireTestIgnored(description); | ||
} | ||
|
||
@Override | ||
public void fireTestStarted(T description) { | ||
decoratee.fireTestStarted(description); | ||
} | ||
|
||
@Override | ||
public void fireTestFinished(T description) { | ||
decoratee.fireTestFinished(description); | ||
} | ||
|
||
@Override | ||
public void fireTestAssumptionFailed(F failure) { | ||
decoratee.fireTestAssumptionFailed(failure); | ||
hasFailedYet = true; | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/com/greghaskins/spectrum/internal/FailureDetectingRunListener.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
src/main/java/com/greghaskins/spectrum/internal/RunReporting.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,41 @@ | ||
package com.greghaskins.spectrum.internal; | ||
|
||
/** | ||
* Abstraction of reporting that's done on a test run. This | ||
* decouples Spectrum from JUnit and also allows Spectrum to | ||
* report its own way with an adapter for each test framework | ||
* providing the right updates according to the target framework's | ||
* needs/expectations. | ||
*/ | ||
public interface RunReporting<T, F> { | ||
/** | ||
* Marks the test as ignored. | ||
* @param description description of test | ||
*/ | ||
void fireTestIgnored(final T description); | ||
|
||
/** | ||
* Markes the test as having started - call this before any test-specific results. | ||
* @param description description of test | ||
*/ | ||
void fireTestStarted(final T description); | ||
|
||
/** | ||
* Marks the test as finished - call this after any test-specific results, whether | ||
* passed or failed. | ||
* @param description description of test | ||
*/ | ||
void fireTestFinished(final T description); | ||
|
||
/** | ||
* Marks a test as having failed. | ||
* @param failure failure information | ||
*/ | ||
void fireTestFailure(final F failure); | ||
|
||
/** | ||
* Marks a test as having an assumption failure. | ||
* @param failure failure information | ||
*/ | ||
void fireTestAssumptionFailed(final F failure); | ||
} |
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
Oops, something went wrong.