diff options
Diffstat (limited to 'src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java')
-rw-r--r-- | src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java b/src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java index 5a33368..4c87bae 100644 --- a/src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java +++ b/src/net/gcdc/asn1/test/UperEncodeIntegerExtensionTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals; import java.util.logging.Level; import net.gcdc.asn1.datatypes.Asn1BigInteger; +import net.gcdc.asn1.datatypes.FieldOrder; import net.gcdc.asn1.datatypes.HasExtensionMarker; import net.gcdc.asn1.datatypes.IsExtension; import net.gcdc.asn1.datatypes.Sequence; @@ -51,14 +52,17 @@ Encoded successfully in 21 bytes: @HasExtensionMarker public static class TestRecord { - + @FieldOrder(order = 0) Asn1BigInteger value1; + @FieldOrder(order = 2) + @IsExtension + Asn1BigInteger value3; + + @FieldOrder(order = 1) @IsExtension Asn1BigInteger value2; - @IsExtension - Asn1BigInteger value3; public TestRecord() { value1 = new Asn1BigInteger(12345678909999899L); @@ -74,26 +78,14 @@ Encoded successfully in 21 bytes: TestRecord record = new TestRecord(); byte[] encoded = UperEncoder.encode(record); - String hex = UperEncoder.hexStringFromBytes(encoded); - UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); - assertEquals("8395EE2A2EF8858D81C1814052C8C338C0C09F4040",hex); - - - } - - @Test public void testDecode() throws IllegalArgumentException, IllegalAccessException { - - TestRecord record = new TestRecord(); - byte[] encoded = UperEncoder.encode(record); - String hex = UperEncoder.hexStringFromBytes(encoded); - UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex)); - assertEquals("8395EE2A2EF8858D81C1814052C8C338C0C09F4040",hex); - TestRecord result = UperEncoder.decode(encoded, TestRecord.class); assertEquals(result.value1.longValue(),record.value1.longValue()); assertEquals(result.value2.longValue(),record.value2.longValue()); assertEquals(result.value3.longValue(),record.value3.longValue()); + } + + } |