From ec3bf519ed5059706631a02d3650c2b3804fd291 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Wed, 14 Oct 2020 13:03:22 +0300 Subject: [PATCH] Add tests for controllers Signed-off-by: Pekka Helenius --- .../web/dev/BookDevControllerTest.java | 33 +++++++++++++++++++ .../web/json/BookRestControllerTest.java | 31 +++++++++++++++++ .../rest/BookBasePathAwareControllerTest.java | 33 +++++++++++++++++++ .../web/webform/BookControllerTest.java | 33 +++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 bookstore/src/test/java/com/fjordtek/bookstore/web/dev/BookDevControllerTest.java create mode 100644 bookstore/src/test/java/com/fjordtek/bookstore/web/json/BookRestControllerTest.java create mode 100644 bookstore/src/test/java/com/fjordtek/bookstore/web/rest/BookBasePathAwareControllerTest.java create mode 100644 bookstore/src/test/java/com/fjordtek/bookstore/web/webform/BookControllerTest.java diff --git a/bookstore/src/test/java/com/fjordtek/bookstore/web/dev/BookDevControllerTest.java b/bookstore/src/test/java/com/fjordtek/bookstore/web/dev/BookDevControllerTest.java new file mode 100644 index 0000000..0bef035 --- /dev/null +++ b/bookstore/src/test/java/com/fjordtek/bookstore/web/dev/BookDevControllerTest.java @@ -0,0 +1,33 @@ +// Pekka Helenius , Fjordtek 2020 + +package com.fjordtek.bookstore.web.dev; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fjordtek.bookstore.web.BookDevController; + +/** + * + * TODO: N/A + * + * @author Pekka Helenius + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +public class BookDevControllerTest { + + @Autowired + private BookDevController bookDevController; + + @Test + public void contextLoads() throws Exception { + assertThat(bookDevController).isNotNull(); + } +} \ No newline at end of file diff --git a/bookstore/src/test/java/com/fjordtek/bookstore/web/json/BookRestControllerTest.java b/bookstore/src/test/java/com/fjordtek/bookstore/web/json/BookRestControllerTest.java new file mode 100644 index 0000000..c82b69d --- /dev/null +++ b/bookstore/src/test/java/com/fjordtek/bookstore/web/json/BookRestControllerTest.java @@ -0,0 +1,31 @@ +package com.fjordtek.bookstore.web.json; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fjordtek.bookstore.web.BookRestController; + +/** + * + * TODO: N/A + * + * @author Pekka Helenius + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +public class BookRestControllerTest { + + @Autowired + private BookRestController bookRestController; + + @Test + public void contextLoads() throws Exception { + assertThat(bookRestController).isNotNull(); + } +} \ No newline at end of file diff --git a/bookstore/src/test/java/com/fjordtek/bookstore/web/rest/BookBasePathAwareControllerTest.java b/bookstore/src/test/java/com/fjordtek/bookstore/web/rest/BookBasePathAwareControllerTest.java new file mode 100644 index 0000000..08777e8 --- /dev/null +++ b/bookstore/src/test/java/com/fjordtek/bookstore/web/rest/BookBasePathAwareControllerTest.java @@ -0,0 +1,33 @@ +// Pekka Helenius , Fjordtek 2020 + +package com.fjordtek.bookstore.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fjordtek.bookstore.web.BookBasePathAwareController; + +/** + * + * TODO: N/A + * + * @author Pekka Helenius + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +public class BookBasePathAwareControllerTest { + + @Autowired + private BookBasePathAwareController bookBasePathAwareController; + + @Test + public void contextLoads() throws Exception { + assertThat(bookBasePathAwareController).isNotNull(); + } +} \ No newline at end of file diff --git a/bookstore/src/test/java/com/fjordtek/bookstore/web/webform/BookControllerTest.java b/bookstore/src/test/java/com/fjordtek/bookstore/web/webform/BookControllerTest.java new file mode 100644 index 0000000..336a849 --- /dev/null +++ b/bookstore/src/test/java/com/fjordtek/bookstore/web/webform/BookControllerTest.java @@ -0,0 +1,33 @@ +// Pekka Helenius , Fjordtek 2020 + +package com.fjordtek.bookstore.web.webform; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fjordtek.bookstore.web.BookController; + +/** + * + * TODO: N/A + * + * @author Pekka Helenius + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +public class BookControllerTest { + + @Autowired + private BookController bookController; + + @Test + public void contextLoads() throws Exception { + assertThat(bookController).isNotNull(); + } +} \ No newline at end of file