Move tests in anticipation of HAPI 3

This commit is contained in:
James Agnew 2017-07-26 15:30:24 -04:00
parent 09e23d857f
commit 6aa58cf887
2 changed files with 43 additions and 26 deletions

View File

@ -1,19 +1,18 @@
package ca.uhn.fhir.rest.param;
import static org.junit.Assert.*;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.rest.method.QualifiedParamList;
import ca.uhn.fhir.util.TestUtil;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
public class TokenOrListParamTest {
import org.junit.AfterClass;
import org.junit.Test;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.util.TestUtil;
public class TokenOrListParamDstu2Test {
@Test
public void testWhenParamListHasAnyMatchingCodingsForCodingList_doesCodingListMatch_shouldBeTrue() {
TokenOrListParam params = new TokenOrListParam();
@ -53,22 +52,6 @@ public class TokenOrListParamTest {
assertFalse(params.doesCodingListMatch(codings));
}
/**
* See #192
*/
@Test
public void testParseExcaped() {
TokenOrListParam params = new TokenOrListParam();
params.setValuesAsQueryTokens(ourCtx, null, QualifiedParamList.singleton("system|code-include-but-not-end-with-comma\\,suffix"));
assertEquals(1, params.getListAsCodings().size());
assertEquals("system", params.getListAsCodings().get(0).getSystemElement().getValue());
assertEquals("code-include-but-not-end-with-comma,suffix", params.getListAsCodings().get(0).getCodeElement().getValue());
}
private static FhirContext ourCtx = FhirContext.forDstu1();
@AfterClass
public static void afterClassClearContext() {
TestUtil.clearAllStaticFieldsForUnitTest();

View File

@ -0,0 +1,34 @@
package ca.uhn.fhir.rest.param;
import static org.junit.Assert.assertEquals;
import org.junit.AfterClass;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.method.QualifiedParamList;
import ca.uhn.fhir.util.TestUtil;
public class TokenOrListParamDstu3Test {
private static FhirContext ourCtx = FhirContext.forDstu3();
/**
* See #192
*/
@Test
public void testParseExcaped() {
TokenOrListParam params = new TokenOrListParam();
params.setValuesAsQueryTokens(ourCtx, null, QualifiedParamList.singleton("system|code-include-but-not-end-with-comma\\,suffix"));
assertEquals(1, params.getListAsCodings().size());
assertEquals("system", params.getListAsCodings().get(0).getSystemElement().getValue());
assertEquals("code-include-but-not-end-with-comma,suffix", params.getListAsCodings().get(0).getCodeElement().getValue());
}
@AfterClass
public static void afterClassClearContext() {
TestUtil.clearAllStaticFieldsForUnitTest();
}
}