resolve merge conflicts

This commit is contained in:
Denis
2019-10-06 20:08:55 +02:00
2409 changed files with 22044 additions and 12068 deletions

View File

@@ -1,7 +1,8 @@
package com.baeldung.validation.application;
package com.baeldung.beanvalidation.application;
import com.baeldung.beanvalidation.application.entities.User;
import com.baeldung.beanvalidation.application.repositories.UserRepository;
import com.baeldung.validation.application.entities.User;
import com.baeldung.validation.application.repositories.UserRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@@ -1,7 +1,8 @@
package com.baeldung.validation.application.controllers;
package com.baeldung.beanvalidation.application.controllers;
import com.baeldung.beanvalidation.application.entities.User;
import com.baeldung.beanvalidation.application.repositories.UserRepository;
import com.baeldung.validation.application.entities.User;
import com.baeldung.validation.application.repositories.UserRepository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -1,4 +1,4 @@
package com.baeldung.validation.application.entities;
package com.baeldung.beanvalidation.application.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

View File

@@ -1,8 +1,9 @@
package com.baeldung.validation.application.repositories;
package com.baeldung.beanvalidation.application.repositories;
import com.baeldung.validation.application.entities.User;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.baeldung.beanvalidation.application.entities.User;
@Repository
public interface UserRepository extends CrudRepository<User, Long> {}

View File

@@ -1,7 +1,8 @@
package com.baeldung.validation.application;
package com.baeldung.beanvalidation.application;
import com.baeldung.beanvalidation.application.controllers.UserController;
import com.baeldung.beanvalidation.application.repositories.UserRepository;
import com.baeldung.validation.application.controllers.UserController;
import com.baeldung.validation.application.repositories.UserRepository;
import java.nio.charset.Charset;
import static org.assertj.core.api.Assertions.assertThat;
import org.hamcrest.core.Is;

View File

@@ -2,11 +2,14 @@ package com.baeldung.jsondateformat;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
@@ -22,23 +25,33 @@ import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = DEFINED_PORT, classes = ContactApp.class)
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = ContactApp.class)
@TestPropertySource(properties = {
"spring.jackson.date-format=yyyy-MM-dd HH:mm:ss"
})
public class ContactAppIntegrationTest {
public class ContactAppUnitTest {
private final ObjectMapper mapper = new ObjectMapper();
@Autowired
TestRestTemplate restTemplate;
@LocalServerPort
int port;
String url;
@Before
public void before() {
url=String.format("http://localhost:%s", port);
}
@Test
public void givenJsonFormatAnnotationAndJava8DateType_whenGet_thenReturnExpectedDateFormat() throws IOException, ParseException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts", String.class);
assertEquals(200, response.getStatusCodeValue());
@@ -53,7 +66,7 @@ public class ContactAppIntegrationTest {
@Test
public void givenJsonFormatAnnotationAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts/javaUtilDate", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts/javaUtilDate", String.class);
assertEquals(200, response.getStatusCodeValue());
@@ -68,7 +81,7 @@ public class ContactAppIntegrationTest {
@Test
public void givenDefaultDateFormatInAppPropertiesAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts/plainWithJavaUtilDate", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts/plainWithJavaUtilDate", String.class);
assertEquals(200, response.getStatusCodeValue());
@@ -83,7 +96,7 @@ public class ContactAppIntegrationTest {
@Test(expected = DateTimeParseException.class)
public void givenDefaultDateFormatInAppPropertiesAndJava8DateType_whenGet_thenNotApplyFormat() throws IOException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts/plain", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts/plain", String.class);
assertEquals(200, response.getStatusCodeValue());

View File

@@ -2,11 +2,14 @@ package com.baeldung.jsondateformat;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
@@ -19,20 +22,30 @@ import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = DEFINED_PORT, classes = ContactApp.class)
public class ContactAppWithObjectMapperCustomizerIntegrationTest {
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = ContactApp.class)
public class ContactAppWithObjectMapperCustomizerUnitTest {
private final ObjectMapper mapper = new ObjectMapper();
@Autowired
TestRestTemplate restTemplate;
@LocalServerPort
int port;
String url;
@Before
public void before() {
url=String.format("http://localhost:%s", port);
}
@Test
public void givenDefaultDateFormatInAppPropertiesAndLegacyDateType_whenGet_thenReturnExpectedDateFormat() throws IOException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts/plainWithJavaUtilDate", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts/plainWithJavaUtilDate", String.class);
assertEquals(200, response.getStatusCodeValue());
@@ -47,7 +60,7 @@ public class ContactAppWithObjectMapperCustomizerIntegrationTest {
@Test
public void givenDefaultDateFormatInAppPropertiesAndJava8DateType_whenGet_thenReturnExpectedDateFormat() throws IOException {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/contacts/plain", String.class);
ResponseEntity<String> response = restTemplate.getForEntity(url + "/contacts/plain", String.class);
assertEquals(200, response.getStatusCodeValue());