From 159a7182d89172213cf0ca51cda04b9565807faa Mon Sep 17 00:00:00 2001 From: Max Curkovic Date: Sat, 11 Nov 2023 12:02:07 -0500 Subject: [PATCH] More changes as per comments --- pom.xml | 5 ++--- .../com/opinionowl/opinionowl/APIControllerTest.java | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index df4a668..ea04300 100644 --- a/pom.xml +++ b/pom.xml @@ -41,9 +41,8 @@ spring-boot-starter-web - junit - junit - test + org.projectlombok + lombok diff --git a/src/test/java/com/opinionowl/opinionowl/APIControllerTest.java b/src/test/java/com/opinionowl/opinionowl/APIControllerTest.java index 7469399..c3ab73b 100644 --- a/src/test/java/com/opinionowl/opinionowl/APIControllerTest.java +++ b/src/test/java/com/opinionowl/opinionowl/APIControllerTest.java @@ -1,14 +1,11 @@ package com.opinionowl.opinionowl; import com.opinionowl.opinionowl.models.Survey; import com.opinionowl.opinionowl.repos.*; -//import org.junit.Test; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; 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.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -16,7 +13,7 @@ /** * Test class for the post mappings in API Controller. */ -@SpringBootTest +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @AutoConfigureMockMvc public class APIControllerTest { @Autowired @@ -38,8 +35,9 @@ public void testCreateSurvey() throws Exception{ .contentType(MediaType.APPLICATION_JSON).content(postData)) .andExpect(status().isOk()); - Survey survey = surveyRepository.findById(1L); - System.out.println(survey); + for (Survey survey : surveyRepository.findAll()) { + System.out.println(survey.toString()); + } } }