evainga / rememberbrall

A tiny little programme which helps to remember interesting stuff.
2 stars 1 forks source link

Show fix of CustomWebFilterTest #21

Closed mle-enso closed 6 years ago

mle-enso commented 6 years ago

As org.springframework.web.server.adapter.DefaultServerWebExchange and its sub-class org.springframework.mock.web.server.MockServerWebExchange do not define hashcode() implementations, your webFilterChain.filter(mutatedServerWebExchange) could not be successful, because the principle of verifying the correct mocking of a method depends on hashcode(). If this is not defined the one of the java.lang.Object gets into action and this means referential equality, which is, of course, not the case in your test. So we have to use a cool Mockito feature called argument captor. Try to figure out how it works and read the docs here: http://static.javadoc.io/org.mockito/mockito-core/2.13.0/org/mockito/Mockito.html#15

codecov-io commented 6 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (WebFilterChainTest@d15635b). Click here to learn what that means. The diff coverage is 100%.

Impacted file tree graph

@@                  Coverage Diff                  @@
##             WebFilterChainTest      #21   +/-   ##
=====================================================
  Coverage                      ?   94.54%           
  Complexity                    ?       28           
=====================================================
  Files                         ?        7           
  Lines                         ?       55           
  Branches                      ?        1           
=====================================================
  Hits                          ?       52           
  Misses                        ?        2           
  Partials                      ?        1
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/de/rememberbrall/CustomWebFilter.java 100% <100%> (ø) 3 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d15635b...2d9bb08. Read the comment docs.