demos/testing
3 years agoCustomized the error-pages by adding a template master unit-vs-integration
Kai Moritz [Fri, 28 Aug 2020 09:14:25 +0000 (11:14 +0200)]
Customized the error-pages by adding a template

3 years agoImplemented a narrow integration-test: DemoApplicationIT
Kai Moritz [Fri, 10 Jan 2020 19:07:51 +0000 (20:07 +0100)]
Implemented a narrow integration-test: DemoApplicationIT

* Using testcontainers.org to start a Nginx-server in a container
* Using mock-server.org to intercept the HTTP-requests, if needed
* Implemented IntegrationTestBase to start Nginx and MockServer
* src/test/resources/index.html is needed, because the NginxContainer
  checks for it
* Using Jsoup to pick the remotly fetched text out of the rendered HTML

3 years agoVerified correct behavior of RestController for 404
Kai Moritz [Thu, 16 Jan 2020 08:58:52 +0000 (09:58 +0100)]
Verified correct behavior of RestController for 404

* Added @Test RestControllerIT.testResponseNotFound()
* Fixed the behavior of the RestController accordingly
* Adapted RestControllerTest accordingly

4 years agoRestController throws different exceptions for other errors
Kai Moritz [Tue, 14 Jan 2020 23:45:15 +0000 (00:45 +0100)]
RestController throws different exceptions for other errors

* Goal: distinguish between errors, that occure during the fetching of the
  data and errors, that may occure elswhere in RemoteController
* Added an unit-test, that verifies the distinction
* Fixed the behavior of RestController accordingly

4 years agoRestController throws 503 Service Unavailable, if the remote-server fails
Kai Moritz [Tue, 14 Jan 2020 23:58:26 +0000 (00:58 +0100)]
RestController throws 503 Service Unavailable, if the remote-server fails

* Added unit-test RestControllerTest.testResponseOtherErrors()
* Fixed the behavior of the RestController accordingly

4 years agoVerified, that RestController throws NotFound, if remote-data does not exist
Kai Moritz [Tue, 14 Jan 2020 19:11:06 +0000 (20:11 +0100)]
Verified, that RestController throws NotFound, if remote-data does not exist

* This tests may seem to check the value reached into the class by the test
  itself, because RestController simply returns the fetched Mono at the
  moment
* But it is valuable, because it verifies, that the behavior stays unchanged,
  when the implementation of RestControler is changed

4 years agoVerified, that requests to the RestController without "path" are invalid
Kai Moritz [Tue, 14 Jan 2020 19:04:27 +0000 (20:04 +0100)]
Verified, that requests to the RestController without "path" are invalid

4 years agoAdded more tests for valid URI's (aka: with parameter)
Kai Moritz [Tue, 14 Jan 2020 18:52:10 +0000 (19:52 +0100)]
Added more tests for valid URI's (aka: with parameter)

* Switchted @Test to @ParameterizedTest in HtmlControllerTest and
  RestControllerTest
* Fixed the behavior of RestController accordingly

4 years agoAdded an integration-tests for RestController
Kai Moritz [Tue, 14 Jan 2020 18:43:15 +0000 (19:43 +0100)]
Added an integration-tests for RestController

4 years agoAdded a rest-controller, that serves the fetched data as text/plain
Kai Moritz [Mon, 13 Jan 2020 11:43:27 +0000 (12:43 +0100)]
Added a rest-controller, that serves the fetched data as text/plain

4 years agoThe parameter "path" is added to the model
Kai Moritz [Tue, 14 Jan 2020 17:56:15 +0000 (18:56 +0100)]
The parameter "path" is added to the model

* Modified HtmlControllerTest to verify the new behavior
* Fixed the behavior of the HtmlController accordingly
* Added a form to the example-layout

4 years agoAdded more tests for URI's without a parameter
Kai Moritz [Tue, 14 Jan 2020 17:28:22 +0000 (18:28 +0100)]
Added more tests for URI's without a parameter

* Transformed test into a @ParameterizedTest
* Fixed the behavior of the HtmlController accordingly

4 years agoMissing path-parameter renders a page without remote-data (no 400)
Kai Moritz [Tue, 14 Jan 2020 17:06:41 +0000 (18:06 +0100)]
Missing path-parameter renders a page without remote-data (no 400)

* Added a test to MappingIT, that defines the expected behavior
* Fixed the behavior in HtmlController accordingly

4 years agoSwitched parameterized test in HtmlControllerTest to @EnumSource
Kai Moritz [Tue, 14 Jan 2020 16:48:04 +0000 (17:48 +0100)]
Switched parameterized test in HtmlControllerTest to @EnumSource

4 years agoChecked, that the error-messeage is rendered for other common errors
Kai Moritz [Tue, 14 Jan 2020 16:26:16 +0000 (17:26 +0100)]
Checked, that the error-messeage is rendered for other common errors

* Added a unit-test, that defines the expected behavior for other errors
* Since the HtmlController simply used getMessage(), no modification was
  necessary to comply with the added test

4 years agoThe error-message is reanderd instead of the text, in case of a 404
Kai Moritz [Tue, 14 Jan 2020 16:08:19 +0000 (17:08 +0100)]
The error-message is reanderd instead of the text, in case of a 404

* Added a unit-test, that defines the expected behavior
* Fixed the behavior in HtmlController accordingly

4 years agoAdded an integration-test for HtmlController
Kai Moritz [Tue, 14 Jan 2020 09:16:06 +0000 (10:16 +0100)]
Added an integration-test for HtmlController

* The test verifies the mapping from URL's to controllers

4 years agoSeparated layout from content with Thymeleaf
Kai Moritz [Thu, 16 Jan 2020 09:16:23 +0000 (10:16 +0100)]
Separated layout from content with Thymeleaf

4 years agoAdded a html-controller, that renders the fetched data
Kai Moritz [Mon, 13 Jan 2020 18:25:37 +0000 (19:25 +0100)]
Added a html-controller, that renders the fetched data

4 years agoFurther simplification: using the real WebClient with an ExchangeFunction
Kai Moritz [Sun, 12 Jan 2020 14:04:35 +0000 (15:04 +0100)]
Further simplification: using the real WebClient with an ExchangeFunction

4 years agoImplemented a WebClientStub to simplify the unit-test
Kai Moritz [Sat, 11 Jan 2020 21:00:41 +0000 (22:00 +0100)]
Implemented a WebClientStub to simplify the unit-test

4 years agoUnit-test with mocking, that does not determines the implementation
Kai Moritz [Sat, 11 Jan 2020 18:51:09 +0000 (19:51 +0100)]
Unit-test with mocking, that does not determines the implementation

4 years agoImplemented a seemingly pure and clean unit-test
Kai Moritz [Sat, 11 Jan 2020 15:30:26 +0000 (16:30 +0100)]
Implemented a seemingly pure and clean unit-test

4 years agoImplemented a service, that fetches data from a remote-host
Kai Moritz [Sat, 11 Jan 2020 15:28:59 +0000 (16:28 +0100)]
Implemented a service, that fetches data from a remote-host

4 years agoSpring Initializr: 2.2.2 / Spring Webflux / Thymeleaf
Kai Moritz [Fri, 10 Jan 2020 18:16:35 +0000 (19:16 +0100)]
Spring Initializr: 2.2.2 / Spring Webflux / Thymeleaf