Merge pull request #6719 from amit2103/BAEL-14088

[BAEL-14088] - Moved code for RequestBody and ResponseBody annotation…
This commit is contained in:
Loredana Crusoveanu 2019-04-15 23:45:07 +03:00 committed by GitHub
commit b0a32bd0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 19 deletions

View File

@ -0,0 +1,31 @@
package com.baeldung.transfer;
public class LoginForm {
private String username;
private String password;
public LoginForm() {
}
public LoginForm(String username, String password) {
super();
this.username = username;
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.controllers;
package com.baeldung.web.controller;
import com.baeldung.services.ExampleService;
import com.baeldung.transfer.ResponseTransfer;

View File

@ -1,8 +1,10 @@
package com.baeldung.controllers;
import com.baeldung.sampleapp.config.MainApplication;
import com.baeldung.services.ExampleService;
import com.baeldung.transfer.LoginForm;
import static org.mockito.Mockito.when;
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.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -14,13 +16,13 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.mockito.Mockito.when;
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.status;
import com.baeldung.SpringBootRestApplication;
import com.baeldung.services.ExampleService;
import com.baeldung.transfer.LoginForm;
import com.baeldung.web.controller.ExamplePostController;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MainApplication.class)
@SpringBootTest(classes = SpringBootRestApplication.class)
public class ExamplePostControllerRequestIntegrationTest {
MockMvc mockMvc;

View File

@ -1,8 +1,11 @@
package com.baeldung.controllers;
import com.baeldung.sampleapp.config.MainApplication;
import com.baeldung.services.ExampleService;
import com.baeldung.transfer.LoginForm;
import static org.mockito.Mockito.when;
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.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -11,18 +14,16 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.mockito.Mockito.when;
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.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import com.baeldung.SpringBootRestApplication;
import com.baeldung.services.ExampleService;
import com.baeldung.transfer.LoginForm;
import com.baeldung.web.controller.ExamplePostController;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MainApplication.class)
@SpringBootTest(classes = SpringBootRestApplication.class)
public class ExamplePostControllerResponseIntegrationTest {
MockMvc mockMvc;