Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve the issues reported in #110 with bad reporting of errors #111

Merged
merged 1 commit into from
Apr 21, 2017

Conversation

ashleyfrieze
Copy link
Contributor

Fixes #110

Errors were reported in the wrong order confusing IDE JUnit runners

@@ -16,7 +16,7 @@ allprojects {
dependencies {
compile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.7.22'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded to the latest Mockito to allow easier argThat

@@ -257,7 +258,7 @@ public Description getDescription() {

@Override
public void run(final RunNotifier notifier) {
this.rootSuite.run(notifier);
this.rootSuite.run(new RunNotifierReporting(notifier));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real run notifier is wrapped by the reporting interface.

@codecov
Copy link

codecov bot commented Apr 18, 2017

Codecov Report

Merging #111 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master     #111      +/-   ##
============================================
+ Coverage      99.4%   99.43%   +0.03%     
- Complexity      312      331      +19     
============================================
  Files            39       40       +1     
  Lines           669      714      +45     
  Branches         16       21       +5     
============================================
+ Hits            665      710      +45     
  Partials          4        4
Impacted Files Coverage Δ Complexity Δ
...kins/spectrum/dsl/specification/Specification.java 100% <ø> (ø) 19 <0> (ø) ⬇️
...spectrum/internal/hooks/AbstractSupplyingHook.java 100% <ø> (ø) 7 <0> (ø) ⬇️
.../com/greghaskins/spectrum/internal/hooks/Hook.java 100% <ø> (ø) 1 <0> (ø) ⬇️
...m/greghaskins/spectrum/internal/CompositeTest.java 100% <100%> (ø) 5 <3> (ø) ⬇️
...com/greghaskins/spectrum/internal/hooks/Hooks.java 100% <100%> (ø) 21 <5> (+2) ⬆️
...n/java/com/greghaskins/spectrum/internal/Spec.java 100% <100%> (ø) 11 <1> (+1) ⬆️
.../java/com/greghaskins/spectrum/internal/Suite.java 100% <100%> (ø) 53 <13> (+5) ⬆️
.../java/com/greghaskins/spectrum/internal/Child.java 100% <100%> (ø) 3 <1> (+1) ⬆️
...skins/spectrum/internal/blocks/NotifyingBlock.java 100% <100%> (ø) 5 <4> (ø) ⬇️
.../spectrum/internal/junit/RunNotifierReporting.java 100% <100%> (ø) 7 <7> (?)
... and 4 more

suite.runChild(child, runNotifier);
private static void abortOnFailureChildRunner(final Suite suite,
final RunReporting<Description, Failure> reporting) {
FailureDetectingRunDecorator<Description, Failure> decoratedReporting =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This decorator simplifies the method a lot. We no longer add a listener to the RunNotifier but instead wrap the Reporting with a sentinel.

.filter(child -> !child.isEffectivelyIgnored())
.findFirst()
.isPresent();
.anyMatch(child -> !child.isEffectivelyIgnored());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplification suggested by IntelliJ.

@greghaskins
Copy link
Owner

@ashleyfrieze looks great to me. If you confirmed that it gets the right IDE behavior, I'm ready to merge. 👍

Also has nice side effect, as you mentioned, of starting to isolate us incrementally away from the JUnit4 RunNotifier API.

@ashleyfrieze
Copy link
Contributor Author

I'm pretty happy with this. Can you release it too? I feel bad that the general release has this howler in it?

@greghaskins greghaskins merged commit 6fc95ab into greghaskins:master Apr 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants