1 package net.jaekl.cfb.xml.messages;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
6 import java.io.ByteArrayInputStream;
7 import java.io.FileNotFoundException;
8 import java.io.IOException;
9 import java.io.UnsupportedEncodingException;
11 import net.jaekl.cfb.analyze.MessageMap;
12 import net.jaekl.cfb.xml.MessagesXmlData;
14 import org.junit.Test;
15 import org.xml.sax.InputSource;
16 import org.xml.sax.SAXException;
18 public class MessageCollectionTest {
19 private final String UNDEFINED_TYPE = "ThisTypeDoesNotExist";
22 public void testGetPatternForUnknownType() throws FileNotFoundException, UnsupportedEncodingException, IOException, SAXException {
23 MessageMap msgMap = new MessageMap();
24 msgMap.parse(new InputSource(new ByteArrayInputStream(MessagesXmlData.XML.getBytes("UTF-8"))));
26 MessageCollection msgColl = msgMap.getColl();
27 assertNotNull(msgColl);
29 BugPattern pat = msgColl.getPattern(UNDEFINED_TYPE);
31 assertEquals(BugPattern.UNKNOWN.getId(), pat.getId());