-
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.
Feat/visualize household business (#321)
* Issue #317 visualize links : separate web business/household * style: readability in visualize methods * feat : visualize-household-business * fix: resolve conflict in EnoClientImpl.java * fix: resolve conflict #2 in EnoClientImpl.java * fix: resolve conflict #3 in EnoClientImpl.java * fix: resolve conflict #4 in EnoClientImpl.java * fix: resolve conflict #5 in EnoClientImpl.java * chore: bump version --------- Co-authored-by: Nicolas Senave <[email protected]>
- Loading branch information
1 parent
a9b9d66
commit c699c6b
Showing
4 changed files
with
159 additions
and
49 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
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
74 changes: 74 additions & 0 deletions
74
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,74 @@ | ||
package fr.insee.pogues.api.remote.eno.transforms; | ||
|
||
import fr.insee.pogues.webservice.model.StudyUnitEnum; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.EnumSource; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class EnoClientImplTest { | ||
@Test | ||
void testWSPathWhenContextIsDefault() { | ||
|
||
// Call the method | ||
String wsPath = EnoClientImpl.buildWSPath(StudyUnitEnum.DEFAULT, "CAWI"); | ||
|
||
// Check that the default context is being used | ||
assertEquals("questionnaire/DEFAULT/lunatic-json/CAWI", wsPath); | ||
} | ||
|
||
@ParameterizedTest | ||
@EnumSource(StudyUnitEnum.class) // Test with all values of StudyUnitEnum | ||
void testWSPathWithDifferentContexts(StudyUnitEnum context) { | ||
|
||
// Call the method | ||
String wsPath = EnoClientImpl.buildWSPath(context, "CAWI"); | ||
|
||
// Check that the correct context is being used | ||
assertEquals("questionnaire/" + context + "/lunatic-json/CAWI", wsPath); | ||
} | ||
|
||
@Test | ||
void testGetContextParam_withContextKey() { | ||
Map<String, Object> params = new HashMap<>(); | ||
params.put("context", StudyUnitEnum.BUSINESS); | ||
|
||
StudyUnitEnum result = EnoClientImpl.getContextParam(params); | ||
|
||
assertEquals(StudyUnitEnum.BUSINESS, result); | ||
} | ||
|
||
@Test | ||
void testGetContextParam_withoutContextKey() { | ||
Map<String, Object> params = new HashMap<>(); | ||
|
||
StudyUnitEnum result = EnoClientImpl.getContextParam(params); | ||
|
||
assertEquals(StudyUnitEnum.DEFAULT, result); | ||
} | ||
|
||
@Test | ||
void testGetContextParam_withIncorrectContextKey() { | ||
Map<String, Object> params = new HashMap<>(); | ||
params.put("notAContext","notAValue"); | ||
|
||
StudyUnitEnum result = EnoClientImpl.getContextParam(params); | ||
|
||
assertEquals(StudyUnitEnum.DEFAULT, result); | ||
} | ||
|
||
@Test | ||
void testGetContextParam_withNullKey() { | ||
Map<String, Object> params = new HashMap<>(); | ||
params.put("context", null); | ||
|
||
StudyUnitEnum result = EnoClientImpl.getContextParam(params); | ||
|
||
assertEquals(StudyUnitEnum.DEFAULT, result); | ||
} | ||
|
||
} |