-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #317 visualize links : separate web business/household
- Loading branch information
1 parent
f7f91a1
commit fe57170
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
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
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
56 changes: 56 additions & 0 deletions
56
src/test/java/fr/insee/pogues/api/remote/eno/transforms/EnoClientImplTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package fr.insee.pogues.api.remote.eno.transforms; | ||
|
||
import fr.insee.pogues.webservice.model.StudyUnitEnum; | ||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.EnumSource; | ||
import org.mockito.Mockito; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class EnoClientImplTest { | ||
@Test | ||
void testWSPathWhenContextIsMissing() { | ||
// Mock de WebClient | ||
WebClient webClient = Mockito.mock(WebClient.class); | ||
|
||
// Création de l'instance d'EnoClientImpl avec WebClient mocké | ||
EnoClientImpl client = new EnoClientImpl(webClient); | ||
|
||
// Paramètres d'entrée | ||
Map<String, Object> params = new HashMap<>(); | ||
params.put("mode", "CAWI"); // Mode explicite | ||
|
||
// Appel de la méthode | ||
String wsPath = client.buildWSPath(client.getContextParam(params), "CAWI"); | ||
|
||
// Vérification que le contexte par défaut est utilisé | ||
assertEquals("questionnaire/DEFAULT/lunatic-json/CAWI", wsPath); | ||
} | ||
|
||
@ParameterizedTest | ||
@EnumSource(StudyUnitEnum.class) // Test avec toutes les valeurs de StudyUnitEnum | ||
void testWSPathWithDifferentContexts(StudyUnitEnum context) { | ||
// Mock de WebClient | ||
WebClient webClient = Mockito.mock(WebClient.class); | ||
|
||
// Création de l'instance d'EnoClientImpl avec WebClient mocké | ||
EnoClientImpl client = new EnoClientImpl(webClient); | ||
|
||
// Paramètres d'entrée | ||
Map<String, Object> params = new HashMap<>(); | ||
params.put("mode", "CAWI"); // Mode explicite | ||
params.put("context", context); // Contexte à tester | ||
|
||
// Appel de la méthode | ||
String wsPath = client.buildWSPath(client.getContextParam(params), "CAWI"); | ||
|
||
// Vérification que le contexte correct est utilisé | ||
assertEquals("questionnaire/" + context + "/lunatic-json/CAWI", wsPath); | ||
} | ||
|
||
} |