From: Chris Jaekl Date: Wed, 30 Dec 2015 06:21:40 +0000 (+0900) Subject: Add extra files that should have been included in the previous commit. X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=commitdiff_plain;h=5ea506df00f2518856a314665d5af11d4581d26d Add extra files that should have been included in the previous commit. --- diff --git a/prod/net/jaekl/cfb/CfbException.java b/prod/net/jaekl/cfb/CfbException.java new file mode 100644 index 0000000..b8a14c0 --- /dev/null +++ b/prod/net/jaekl/cfb/CfbException.java @@ -0,0 +1,9 @@ +package net.jaekl.cfb; + +public class CfbException extends Exception { + private static final long serialVersionUID = 1L; + + public CfbException(String msg) { + super(msg); + } +} diff --git a/prod/net/jaekl/cfb/store/StoreException.java b/prod/net/jaekl/cfb/store/StoreException.java new file mode 100644 index 0000000..5b7544d --- /dev/null +++ b/prod/net/jaekl/cfb/store/StoreException.java @@ -0,0 +1,11 @@ +package net.jaekl.cfb.store; + +import net.jaekl.cfb.CfbException; + +public class StoreException extends CfbException { + private static final long serialVersionUID = 1L; + + public StoreException(String msg) { + super(msg); + } +} diff --git a/test/net/jaekl/cfb/xml/messages/BugCategoryTest.java b/test/net/jaekl/cfb/xml/messages/BugCategoryTest.java new file mode 100644 index 0000000..edc2998 --- /dev/null +++ b/test/net/jaekl/cfb/xml/messages/BugCategoryTest.java @@ -0,0 +1,20 @@ +package net.jaekl.cfb.xml.messages; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class BugCategoryTest { + + @Test + public void testGetUninitializedVariables() { + BugCategory cat = new BugCategory(); + + assertEquals(-1, cat.getId()); + assertEquals("", cat.getAbbrev()); + assertEquals("", cat.getCategory()); + assertEquals("", cat.getDescr()); + assertEquals("", cat.getDetails()); + } + +} diff --git a/test/net/jaekl/cfb/xml/messages/BugPatternTest.java b/test/net/jaekl/cfb/xml/messages/BugPatternTest.java new file mode 100644 index 0000000..de5c481 --- /dev/null +++ b/test/net/jaekl/cfb/xml/messages/BugPatternTest.java @@ -0,0 +1,28 @@ +package net.jaekl.cfb.xml.messages; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class BugPatternTest { + + @Test + public void testGetUninitializedVariables() { + BugPattern pat = new BugPattern(); + + assertEquals((-1), pat.getId()); + assertEquals("", pat.getDetails()); + assertEquals("", pat.getLong()); + assertEquals("", pat.getShort()); + } + + @Test + public void testGetUnknown() { + BugPattern pat = BugPattern.UNKNOWN; + + assertEquals((-2), pat.getId()); + assertEquals("", pat.getDetails()); + assertEquals("", pat.getLong()); + assertEquals("", pat.getShort()); + } +} diff --git a/test/net/jaekl/cfb/xml/messages/MessageCollectionTest.java b/test/net/jaekl/cfb/xml/messages/MessageCollectionTest.java new file mode 100644 index 0000000..d6a7eee --- /dev/null +++ b/test/net/jaekl/cfb/xml/messages/MessageCollectionTest.java @@ -0,0 +1,33 @@ +package net.jaekl.cfb.xml.messages; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import net.jaekl.cfb.analyze.MessageMap; +import net.jaekl.cfb.xml.MessagesXmlData; + +import org.junit.Test; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class MessageCollectionTest { + private final String UNDEFINED_TYPE = "ThisTypeDoesNotExist"; + + @Test + public void testGetPatternForUnknownType() throws FileNotFoundException, UnsupportedEncodingException, IOException, SAXException { + MessageMap msgMap = new MessageMap(); + msgMap.parse(new InputSource(new ByteArrayInputStream(MessagesXmlData.XML.getBytes("UTF-8")))); + + MessageCollection msgColl = msgMap.getColl(); + assertNotNull(msgColl); + + BugPattern pat = msgColl.getPattern(UNDEFINED_TYPE); + assertNotNull(pat); + assertEquals(BugPattern.UNKNOWN.getId(), pat.getId()); + } +}