Created
March 14, 2024 15:17
-
-
Save FranckSilvestre/cadbfa3f260e862d415bd0198d0601c0 to your computer and use it in GitHub Desktop.
v1 in OurBusinessProject 2023-2024
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ourbusinessproject; | |
import org.junit.jupiter.api.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.boot.test.web.client.TestRestTemplate; | |
import static org.junit.jupiter.api.Assertions.assertTrue; | |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
class ProjectControllerIntegrationTest { | |
@Autowired | |
private TestRestTemplate restTemplate; | |
@Autowired | |
private InitializationService initializationService; | |
@Test | |
public void testFindAllProjectsWithEnterprises() { | |
// when requesting all projects | |
String body = this.restTemplate.getForObject("/api/projects", String.class); | |
// then the results provide three projects with their enterprise | |
assertTrue(body.contains(initializationService.getProject1E1().getTitle())); | |
assertTrue(body.contains(initializationService.getProject1E2().getTitle())); | |
assertTrue(body.contains(initializationService.getProject2E1().getTitle())); | |
assertTrue(body.contains(initializationService.getEnterprise1().getName())); | |
assertTrue(body.contains(initializationService.getEnterprise2().getName())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment