Merge pull request #12547 from thibaultfaure/BAEL-842/fix-integrations-tests

Fix failed integration tests
This commit is contained in:
kwoyke 2022-07-30 09:52:49 +02:00 committed by GitHub
commit e9fdf78b77
3 changed files with 2 additions and 20 deletions

View File

@ -47,11 +47,4 @@
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>/src/main/resources</directory>
</resource>
</resources>
</build>
</project>

View File

@ -9,7 +9,6 @@ import org.assertj.core.util.Preconditions;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
@ -26,7 +25,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@ComponentScan(basePackageClasses = WebConfig.class)
@EnableAutoConfiguration
public class EtagIntegrationTest {
@LocalServerPort

View File

@ -1,32 +1,23 @@
package com.baeldung.produceimage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
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.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.springframework.web.context.WebApplicationContext;
@SpringBootTest(classes = ImageApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
public class DataProducerControllerIntegrationTest {
@Autowired
private WebApplicationContext webApplicationContext;
private MockMvc mockMvc;
@BeforeEach
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@Test
void givenJpgTrue_whenGetImageDynamicType_ThenContentTypeIsJpg() throws Exception {
mockMvc.perform(get("/get-image-dynamic-type?jpg=true"))