Fix xml test + add unit tests
This commit is contained in:
parent
2181cb14d5
commit
a8da416ee3
|
@ -19,7 +19,7 @@ public class AuditEvent40_50Test {
|
|||
public static final byte[] THE_BASE_64_BINARY_BYTE_ARRAY = Base64.decodeBase64(THE_BASE_64_BINARY_STRING.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
public static final String INVALID_BASE_64_BINARY_STRING = "Picard was the best starship captain";
|
||||
public static final byte[] INVALID_BASE_64_BINARY_BYTE_ARRAY = Base64.decodeBase64(THE_BASE_64_BINARY_STRING.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
public static final byte[] INVALID_BASE_64_BINARY_BYTE_ARRAY = Base64.decodeBase64(INVALID_BASE_64_BINARY_STRING.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -90,6 +90,6 @@
|
|||
<display value="Access / Use"/>
|
||||
</lifecycle>
|
||||
<name value="Grahame's Laptop"/>
|
||||
<query value="dGhpcyBpcyB2YWxpZCBiYXNlNjQ="/>
|
||||
<query value="Picard was the best starship captain"/>
|
||||
</entity>
|
||||
</AuditEvent>
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.dstu2.model;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -11,6 +12,8 @@ class Base64BinaryTypeTest {
|
|||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -45,6 +48,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertNull(b64.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValid() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.dstu2016may.model;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -11,6 +12,8 @@ class Base64BinaryTypeTest {
|
|||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -45,6 +48,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertNull(b64.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValid() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.dstu3.model;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -11,6 +12,8 @@ class Base64BinaryTypeTest {
|
|||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -54,6 +57,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValidSetValueAsString() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.r4.model;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -11,6 +12,8 @@ class Base64BinaryTypeTest {
|
|||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -54,6 +57,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValidSetValueAsString() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.r4b.model;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -12,6 +13,8 @@ class Base64BinaryTypeTest {
|
|||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -55,6 +58,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValidSetValueAsString() {
|
||||
|
|
|
@ -2,16 +2,20 @@ package org.hl7.fhir.r5.model;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
class Base64BinaryTypeTest {
|
||||
|
||||
static final String NON_BASE_64 = "Picard was the best starship captain.";
|
||||
static final String VALID_BASE_64 = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
|
||||
static final byte[] VALID_BASE_64_BYTES = Base64.decodeBase64(VALID_BASE_64.getBytes(ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8));
|
||||
@Test
|
||||
@DisplayName("Passing a non Base64 encoded String to constructor causes exception.")
|
||||
public void testNonBase64String() {
|
||||
|
@ -55,6 +59,15 @@ class Base64BinaryTypeTest {
|
|||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null bytes.")
|
||||
public void testValidBytes() {
|
||||
Base64BinaryType b64 = new Base64BinaryType(VALID_BASE_64_BYTES);
|
||||
Assertions.assertNotNull(b64);
|
||||
Assertions.assertNotNull(b64.getValue());
|
||||
Assertions.assertEquals(VALID_BASE_64, b64.asStringValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
|
||||
public void testValidSetValueAsString() {
|
||||
|
|
Loading…
Reference in New Issue