-
Notifications
You must be signed in to change notification settings - Fork 98
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
empty elementOfJsonPath #343
Conversation
Looks good. Would you mind adding a test? |
JsonFixtureTest Class & two tests added |
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 good. A few minor points to finish it I believe
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
src/test/java/nl/hsac/fitnesse/fixture/slim/JsonFixtureTest.java
Outdated
Show resolved
Hide resolved
Suggested changes fhoeben Co-authored-by: Fried Hoeben <github@hsac.nl>
Retry commit batch review changes fhoeben Co-authored-by: Fried Hoeben <github@hsac.nl>
@fhoeben changes made, thanks for the feedback. |
Just remembered |
Created mocked tests in JsonHttpTestTest Changed tests in JsonFixtureTest to mocked tests
@fhoeben as per your comment I updated |
Although I really like mockito, I try to keep away from using spies as much as possible as they tend to couple your test too tightly to the implementation. Instead I suggest you take a look at wiki/FitNesseRoot/HsacAcceptanceTests/SlimTests/HttpTest/JsonHttpTest.wiki line 30, I believe adding one line there to check element 2 would be the easiest way to test the changed behaviour (line 30 tests the behaviour when the element is present) |
I could of course not use the spy implementation and just use a mock for the I will revert the changes in the 'JsonFixtureTest'. |
It's an interesting thought though as with a spy I would isolate the specific method and I'm not dependent on changes in other methods. Isn't the FitNesse test therefore not more dependent on the implementation? |
I would prefer The spy indeed isolates the specific method, but that method is the implementation detail. The FitNesse test checks the behaviour of the class given a certain response from the remote server, it's completely decoupled from how the fixture arrives at that response. So JsonHttpTest could be completely refactored (for instance by delegating to JsonFixture, or even rewriting it in Kotlin) and the test needs no change: it still verifies whether the correct response is given. |
Added check null test to JsonHttpTest.wiki
@fhoeben all changes made, should be good now. |
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 good. One minor thing left
return null with empty elementOfJsonPath