BAEL-4687: returned fixed date instead of dynamic
This commit is contained in:
+5
-4
@@ -6,9 +6,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.FIXED_DATE;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@@ -19,13 +19,14 @@ public abstract class AbstractCoffeeIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenGetCoffee_thenSerializedWithDateAndNonNull() {
|
||||
String formattedDate = DateTimeFormatter.ofPattern(CoffeeConstants.dateTimeFormat)
|
||||
.format(LocalDateTime.now());
|
||||
String formattedDate = DateTimeFormatter.ofPattern(CoffeeConstants.DATETIME_FORMAT)
|
||||
.format(FIXED_DATE);
|
||||
|
||||
String brand = "Lavazza";
|
||||
|
||||
String url = "/coffee?brand=" + brand;
|
||||
|
||||
String response = restTemplate.getForObject(url, String.class);
|
||||
|
||||
assertThat(response).isEqualTo(
|
||||
"{\"brand\":\"" + brand + "\",\"date\":\"" + formattedDate + "\"}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user