Added a spring-boot application shell with a dummy message

This commit is contained in:
steam
2020-02-20 23:39:46 +01:00
parent 866c974883
commit 191a5b836d
7 changed files with 115 additions and 2 deletions
@@ -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);
}
}
@@ -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";
}
}
@@ -0,0 +1 @@
@@ -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")));
}
}