Tag { public byte getTagClass() { return tagClass; } Tag(int tagNumber, byte tagClass, TagType tagType, int tagSize);  Tag(byte[] binary, int offset); int getTagNumber(); byte getTagClass(); TagType getTagType(); int getTagSize(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final byte UNIVERSAL; static final byte APPLICATION; static final byte CONTEXT; static final byte PRIVATE; }
@Test public void getTagClass() { Tag tag; tag = new Tag(0x55, Tag.UNIVERSAL, Tag.TagType.PRIMITIVE, 2); Assert.assertEquals(Tag.UNIVERSAL, tag.getTagClass(), 2); tag = new Tag(0x55, Tag.APPLICATION, Tag.TagType.PRIMITIVE, 2); Assert.assertEquals(Tag.APPLICATION, tag.getTagClass(), 2); tag = new Tag(0x55, Tag.CONTEXT, Tag.TagType.PRIMITIVE, 2); Assert.assertEquals(Tag.CONTEXT, tag.getTagClass(), 2); tag = new Tag(0x55, Tag.PRIVATE, Tag.TagType.PRIMITIVE, 2); Assert.assertEquals(Tag.PRIVATE, tag.getTagClass(), 2); tag = new Tag(ByteArrayUtil.fromHex("1F550100"), 0); Assert.assertEquals(Tag.UNIVERSAL, tag.getTagClass()); tag = new Tag(ByteArrayUtil.fromHex("5F550100"), 0); Assert.assertEquals(Tag.APPLICATION, tag.getTagClass()); tag = new Tag(ByteArrayUtil.fromHex("BF550100"), 0); Assert.assertEquals(Tag.CONTEXT, tag.getTagClass()); tag = new Tag(ByteArrayUtil.fromHex("DF550100"), 0); Assert.assertEquals(Tag.PRIVATE, tag.getTagClass()); }