Github user onealj commented on a diff in the pull request:
https://github.com/apache/commons-imaging/pull/27#discussion_r127633319
--- Diff:
src/test/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByteTest.java
---
@@ -0,0 +1,37 @@
+package org.apache.commons.imaging.formats.tiff.fieldtypes;
+
+import org.junit.Test;
+
+import java.nio.ByteOrder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link FieldTypeByte}.
+ *
+ * @date 13.07.2017
+ * @see FieldTypeByte
+ *
+ **/
+public class FieldTypeByteTest{
+
+
+ @Test
+ public void testWriteDataWithNull() {
+
+ FieldTypeByte fieldTypeByte = FieldType.UNDEFINED;
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+ try {
+ fieldTypeByte.writeData( null, byteOrder);
+ fail("Expecting exception: Exception");
+ } catch(Exception e) {
+ assertEquals("Invalid data: null (null)",e.getMessage());
+ assertEquals(FieldTypeByte.class.getName(),
e.getStackTrace()[0].getClassName());
--- End diff --
It may be worth adding a helper method for this..
assertExceptionClassName(FieldTypeByte.class, e);
Why are you needing to look at the stack trace? Can't you look at the
exception class itself?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]