*/
public class ResourceTypeReaderTest extends TestCase {
public void testResourceTypeReaderRead() throws Exception {
ResourceTypeReader reader = new ResourceTypeReader();
byte[] binaryData = new byte[] {
0x03, 0x01, 0x02, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
byte[] evilData = new byte[] {
0x03, 0x01, 0x03, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
byte[] xmlData = new byte[] {
0x03, 0x01, 0x01, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
InlineMetaMap map;
map = reader.read(binaryData, 2, 1);
assertEquals(ResourceTypeReader.BINARY, map.get("type"));
map = reader.read(xmlData, 2, 1);
assertEquals(ResourceTypeReader.XML, map.get("type"));
try {
reader.read(evilData, 2, 1);
fail("failed to throw InlineMetaException on bad type value (3)");
} catch (InlineMetaException e) {
// expected exception
}
}