-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix breaking changes in Render contract #742
Conversation
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.
it should return on the stream not the writer - sth like: return byteArrayOutputStream.toString();
not
return outputStreamWriter.toString();
I can fix and add a test.
@PawelWesolowski you're absolutely right regarding the issue. I just left the testing to the evening, cause had no time. |
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.
Looks awesome.
How about adding a test which is doing exactly what's in the docs? Sth like:
@Test
public void testDiffAndJsonWithoutProvidingStream() {
ChangedOpenApi diff = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2);
Render render = new JsonRender();
String renderedAsString = render.render(diff);
assertThat(renderedAsString).contains("\"newEndpoints\":");
}
at OpenApiDiffTest.java
Each render has its own test class (eg JsonRenderTest), and they are doing pretty much the same as in doc (I've updated Readme to conform to the new approach, the old one is deprecated and can lead to issues) |
None of them failed after the first commit on this fix. The one I suggested did. |
Yep, because this tests cover new approach (with stream, it's also in documentation). To cover deprecated approach I've added RenderTest to test default method of the interface, instead of doing testing for each render implementation. |
#741 fix