Skip to content

Instantly share code, notes, and snippets.

View FranckSilvestre's full-sized avatar

Franck Silvestre FranckSilvestre

View GitHub Profile

Partie 4 – Moteur de recherche RESTFul

1. Création de la classe du domaine Partnership

Un partenariat décrit le partenariat réalisé par une entreprise sur un projet. Un projet est donc proposé par une entreprise mais peut faire l'objet de plusieurs partenariats, c'est à dire de plusieurs entreprises partenaires intervenant sur le projet de différentes manières.

  1. Créez la classe du domaine «ourbusinessproject.Partnership » et la classe de test associée « PartnershipTest ».

  2. Modifiez le contenu du fichier « PartnershipTest .java» de telle sorte qu'il soit identique aux contenus disponibles ici : https://gist.github.com/FranckSilvestre/21a575ff0da1eabb40df5fb63b31ae8e

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 org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@FranckSilvestre
FranckSilvestre / PartnershipControllerTest.java
Created May 23, 2024 06:27
OurBusinessProject BUT3 2024
package ourbusinessproject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@FranckSilvestre
FranckSilvestre / PartnershipServiceIntegrationTest.java
Created May 22, 2024 16:03
OurBusinessProject BUT3 2024 - 2
package ourbusinessproject;
import jakarta.transaction.Transactional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.hamcrest.core.Is.is;
@FranckSilvestre
FranckSilvestre / BootstrapTest.java
Created May 22, 2024 16:02
OurbusinessProjevt BUT3 2024 - 2
package ourbusinessproject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.BDDMockito.willThrow;
package ourbusinessproject;
import jakarta.transaction.Transactional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.junit.jupiter.api.Assertions.*;
@FranckSilvestre
FranckSilvestre / PartnershipTest.java
Created May 22, 2024 14:50
OurBusinessProject BUT3 2024
package ourbusinessproject;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@FranckSilvestre
FranckSilvestre / ProjectControllerIntegrationTest.java
Created March 14, 2024 15:17
v1 in OurBusinessProject 2023-2024
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)
@FranckSilvestre
FranckSilvestre / ProjectControllerTest.java
Created March 14, 2024 15:16
v1 on OurBusinessProject 2023-2024
package ourbusinessproject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.mockito.Mockito.verify;
@FranckSilvestre
FranckSilvestre / EnterpriseProjectServiceIntegrationTest.java
Created March 14, 2024 14:53
v3.2 on OurBusinessProject 2023-2024
package ourbusinessproject;
import jakarta.transaction.Transactional;
import jakarta.validation.ConstraintViolationException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;