reverting unnecessary files
This commit is contained in:
parent
e56da99216
commit
9fee77a9d9
|
@ -1,21 +0,0 @@
|
|||
package org.baeldung.converter.controller;
|
||||
|
||||
import com.baeldung.toggle.Employee;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/string-to-employee")
|
||||
public class StringToEmployeeConverterController {
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Object> getStringToEmployee(@RequestParam("employee") Employee employee) {
|
||||
return ResponseEntity.ok(employee);
|
||||
}
|
||||
|
||||
@PostMapping(consumes = {MediaType.TEXT_PLAIN_VALUE})
|
||||
public ResponseEntity<Object> postStringToEmployee(@RequestBody Employee employee) {
|
||||
return ResponseEntity.ok(employee);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.baeldung.converter.controller;
|
||||
|
||||
import org.baeldung.Application;
|
||||
import org.baeldung.boot.DemoApplication;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class)
|
||||
@AutoConfigureMockMvc
|
||||
//@AutoConfigureTestDatabase
|
||||
public class StringToEmployeeConverterControllerTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void getStringToEmployeeTest() throws Exception {
|
||||
mockMvc.perform(get("/string-to-employee?employee=1,2000"))
|
||||
.andDo(print())
|
||||
.andExpect(jsonPath("$.id", is(1)))
|
||||
.andExpect(jsonPath("$.salary", is(2000.0)))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue