diff --git a/.gitignore b/.gitignore index 46cacd2..b44ffab 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ cmake-build-*/ # IntelliJ out/ +*.iml # mpeltonen/sbt-idea plugin .idea_modules/ @@ -98,7 +99,8 @@ fabric.properties .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/README.md b/README.md index 4fb91ef..efc878e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # my-small-satellite -A coding challenge solution for UP42 \ No newline at end of file +A coding challenge solution for UP42 + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6f19171 --- /dev/null +++ b/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.4.RELEASE + + + click.poweronoff + my-small-satellite + 0.0.1-SNAPSHOT + my-small-satellite + A coding challenge solution for UP42 + + + 11 + 11 + 11 + UTF-8 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/src/main/java/click/poweronoff/satellite/MySmallSatelliteApplication.java b/src/main/java/click/poweronoff/satellite/MySmallSatelliteApplication.java new file mode 100644 index 0000000..e3912a8 --- /dev/null +++ b/src/main/java/click/poweronoff/satellite/MySmallSatelliteApplication.java @@ -0,0 +1,13 @@ +package click.poweronoff.satellite; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class MySmallSatelliteApplication { + + public static void main(String[] args) { + SpringApplication.run(MySmallSatelliteApplication.class, args); + } + +} diff --git a/src/main/java/click/poweronoff/satellite/api/FeaturesController.java b/src/main/java/click/poweronoff/satellite/api/FeaturesController.java new file mode 100644 index 0000000..e9e7e9c --- /dev/null +++ b/src/main/java/click/poweronoff/satellite/api/FeaturesController.java @@ -0,0 +1,16 @@ +package click.poweronoff.satellite.api; + + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class FeaturesController { + @RequestMapping("/features") + public @ResponseBody + String features() { + return "a dummy message"; + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/src/test/java/click/poweronoff/satellite/api/FeaturesControllerTest.java b/src/test/java/click/poweronoff/satellite/api/FeaturesControllerTest.java new file mode 100644 index 0000000..ffa4a4f --- /dev/null +++ b/src/test/java/click/poweronoff/satellite/api/FeaturesControllerTest.java @@ -0,0 +1,27 @@ +package click.poweronoff.satellite.api; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.servlet.MockMvc; + +import static org.hamcrest.Matchers.containsString; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest +@AutoConfigureMockMvc +public class FeaturesControllerTest { + @Autowired + private MockMvc mockMvc; + + @Test + public void shouldReturnDefaultMessage() throws Exception { + this.mockMvc.perform(get("/features")).andDo(print()).andExpect(status().isOk()) + .andExpect(content().string(containsString("a dummy message"))); + } + +} \ No newline at end of file