diff --git a/spring-boot-rest-2/src/main/java/com/baeldung/unsupportedmediatype/User.java b/spring-boot-rest-2/src/main/java/com/baeldung/unsupportedmediatype/User.java
index 74a6f4383b..5f5f2a972c 100644
--- a/spring-boot-rest-2/src/main/java/com/baeldung/unsupportedmediatype/User.java
+++ b/spring-boot-rest-2/src/main/java/com/baeldung/unsupportedmediatype/User.java
@@ -10,6 +10,10 @@ public class User implements Serializable {
private Integer age;
private String address;
+ public User(){
+
+ }
+
public User(Integer id, String name, Integer age, String address){
this.id = id;
this.name = name;
diff --git a/spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmedia/ApplicationTest.java b/spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmediatype/ApplicationUnitTest.java
similarity index 84%
rename from spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmedia/ApplicationTest.java
rename to spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmediatype/ApplicationUnitTest.java
index e5c56d0adc..a84388f750 100644
--- a/spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmedia/ApplicationTest.java
+++ b/spring-boot-rest-2/src/test/java/com/baeldung/unsupportedmediatype/ApplicationUnitTest.java
@@ -1,7 +1,6 @@
-package com.baeldung.unsupportedmedia;
+package com.baeldung.unsupportedmediatype;
-import com.baeldung.unsupportedmediatype.UserController;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
@@ -14,12 +13,12 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@RunWith(SpringRunner.class)
@WebMvcTest(UserController.class)
-public class ApplicationTest {
+public class ApplicationUnitTest {
@Autowired
private MockMvc mockMvc;
@Test
- void JsonTestCase() throws Exception {
+ public void JsonTestCase() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content("{\n" +
@@ -31,7 +30,7 @@ public class ApplicationTest {
}
@Test
- void JsonFailTestCase() throws Exception {// Because no content-type added
+ public void JsonFailTestCase() throws Exception {// Because no content-type added
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.content("{\n" +
" \"name\": \"Andy\",\n" +
@@ -42,7 +41,7 @@ public class ApplicationTest {
}
@Test
- void XmlTestCase() throws Exception {
+ public void XmlTestCase() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.APPLICATION_XML_VALUE)
.content("Andy1Hello world"))
@@ -50,7 +49,7 @@ public class ApplicationTest {
}
@Test
- void StringTestCase() throws Exception {
+ public void StringFailTestCase() throws Exception { // Because content-type is not supported
mockMvc.perform(MockMvcRequestBuilders.post("/user/")
.contentType(MediaType.TEXT_PLAIN_VALUE)
.content("Andy1Hello world"))