summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Kai Moritz [Fri, 2 Oct 2020 17:39:00 +0000 (19:39 +0200)]
Fixed non-working test-cases
Kai Moritz [Sun, 27 Sep 2020 17:54:53 +0000 (19:54 +0200)]
Added spring-boot-devtools
Kai Moritz [Fri, 2 Oct 2020 13:46:09 +0000 (15:46 +0200)]
Adding expectations for the rendered output reveals annother misconception
* Added Jsoup to check some expectations regarding the rendered pages.
* This revealed another misconception about the behaviour of MockMvc.
* The MockMvc-environment does not render a full version of the White Label
ErrorPage, that Spring-Boot shows for uncaught exceptions.
Kai Moritz [Wed, 30 Sep 2020 06:42:38 +0000 (08:42 +0200)]
Refined the test: @ParameterizedTest adds no additional insight here
* The parameterized tests only test the difference between an empty and an
non-empty Optional.
* The actual number is meaningless, because the business logic is mocked
away anyway!
* Hence, the parameterized version only tests the correctness of our mocking:
The test could only fail, if we make a mistake in the setup of the
expectations, not in the code under test!
* Also splitted up some test-cases more logically.
Kai Moritz [Sun, 27 Sep 2020 09:23:03 +0000 (11:23 +0200)]
Further refined the example: Simplified the setup
* Goal: Do not rely on knowledge about Thymeleaf
* Goal: Separate MVC (controller) from business logic (service)
* Introduced an ExampleService
* The service checks the answer for
The Ultimate Question Of Life, The Universe And Everything
* Requests without any answer are tolarated, so that the page with the
question can be rendered
* Only numbers (Integer) are allowed as answer.
* Negative numbers are not allowed as answers: the service answers with an
empty Optional.
* The view contains a bug, that results in a 503 for negative answers:
Optional.get() is called, regardless of the state of the Optional
* The view renders the question, if no answer is specified (initial request!)
* If a valid request is specified, the answer and the outcome is rendered
* If an invalid request (negative number!) is specified, the view generates
an exception, because it tries to resolve the Optional anyway
Kai Moritz [Sat, 19 Sep 2020 08:24:44 +0000 (10:24 +0200)]
Refined the example, to clearify the intent
* Removed unnecessary Annotation from test
* Renamed and pimped up the example templates
* Splitted up the test in separate units
* Remapped the controller to the root of the web-context
* Switched to @WebMvcTest, to load only the controller-layer
Kai Moritz [Sat, 19 Sep 2020 08:11:41 +0000 (10:11 +0200)]
Renamed and repackaged the example for the blog-article
Kai Moritz [Sat, 19 Sep 2020 07:50:41 +0000 (09:50 +0200)]
Initial Commit: Spring-Boot-Project, that pinns down a bug in a test-case
* I stumbled accros the unexpected behaviour of Springs MockMvc in a
test-case for one of my projects.
* This version pinned down the unexpected behaviour explicitly.