-
Notifications
You must be signed in to change notification settings - Fork 48
[MPMD-412] Simplify stub setup by not swallowing exceptions #226
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
Conversation
setModel(model); | ||
} catch (Exception e) { | ||
} | ||
InputStream in = new FileInputStream(getBasedir() + "/" + getPOM()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stream should be closed also in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if we do that the test fails when the pomReader closes the inputstream. Previously this failure was hidden by the empty catch block. This surprised me too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test stream is still open after pomReader.read(is)
, can you show code where is closed in pomReader.read(is)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, maybe that's not where it is, but two tests broke for that inobvious reason when I initially set this up with try with resources. I had to drop the closing to make them pass.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should not skip exception and find root cause
by the way all tests pass on CI, I also didn't have a problems locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL. I've now moved a lot of duplicate code into the superclass and removed still more code that wasn't needed. Since this is all src/test code for this repo only, it's safe to make these API breaking changes in the name of simplicity.
Previously we were suppressing the exception with an empty catch block. This seems to have hidden failures in existing tests. With PR we are no longer hiding such failures |
@@ -427,7 +423,6 @@ public void testSuppressMarkerConfiguration() throws Exception { | |||
// check if there's a link to the JXR files | |||
str = readFile(generatedReport); | |||
|
|||
assertTrue(str.contains("/xref/def/configuration/AppSample.html#L27")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this assertion was removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because as best I can tell the assert is incorrect and broken and has been for some time. That is, I don't think this string is actually expected to appear in the output. However, the bad catch block hid the failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe not, let me take a deeper look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, asserts restored
Resolve #379 |
1 similar comment
Resolve #379 |
Removing Scm objects that were thrown away by the setter not setting anything, and pushing duplicate code up into the superclass.
This PR only changes files in src/test so it should have no effect on the correctness of the actual plugin.