[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127843760
  
--- 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 --

No, you're not right!
Obviously, became already dizzy ...

The difference is that the approach with the stack trace - of course - 
verifies which class the exception originated from.
The verification which exception was thrown and before more over if an 
exception was thrown gets already verified in the catch clause.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127778422
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

@onealj @TheRealHaui If I were maintaining this code, I'd be happy with 
either pattern.

`@Test(expected=NullPointerException.class)` would be a little shorter and 
equivalent to the `try..catch` construct used here in this case.

However, the reason people tend to prefer `try..catch` is because in a lot 
of cases it is not granular enough. Take this (admittedly contrived) example:

```java
@Test(expected=NullPointerException.class)
public void doSomething() {
  String s = null;
  assertTrue(s.isEmpty());
  try {
somethingWhichThrowsNullPointerException():
  } catch (NullPointerException e) {
assertNull(s);
  }
}
```

In this case, rather than `somethingWhichThrowsNullPointerException(s1)` 
throwing `NullPointerException` (which we expect), it will be `s.isEmpty()` 
that throws it instead, which isn't what we intended, since it means the test 
will always "pass".


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127775941
  
--- 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 --

You're right.
Omitting the stack trace is definitely shorter and more intuitive.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127770670
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
+  byteArrayInputStream.read(byteArray);
+
+  try { 
+pbmFileInfo.getRGB((InputStream) byteArrayInputStream);
--- End diff --

Changed.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127770520
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
--- End diff --

Changed to interface.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127769590
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegmentTest.java
 ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.jpeg.segments;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link JfifSegment}.
+ *
+ * @date 13.07.2017
+ * @see JfifSegment
+ *
+ **/
+public class JfifSegmentTest{
+
+
+  @Test
+  public void testCreatesJfifSegment() {
+
+  byte[] byteArray = new byte[25];
+  JfifSegment jfifSegment = null;
+
+  try {
+jfifSegment = new JfifSegment((-2275), byteArray);
+fail("Expecting exception: Exception");
+  } catch(Throwable e) {
--- End diff --

Had to do with the fact that at the beginning the test class resided in a 
different hierarchical folder structure than the original class ...
Corrected.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127768831
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

Yes, I know.
However, for what reason ever I experienced a lot of people preferring the 
try/catch notation over the annotation approach.
That's why I write/wrote it this way.
In the hope to have to rewrite as less code in the end as possible.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127768274
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
+ * @see BmpWriterRgb
+ *
+ **/
+public class BmpWriterRgbTest{
+
+
+@Test
+public void testGetImageData() {
+
+BmpWriterRgb bmpWriterRgb = new BmpWriterRgb();
+BufferedImage bufferedImage = new BufferedImage(2, 2, 5);
+byte[] byteArray = bmpWriterRgb.getImageData(bufferedImage);
+
+assertEquals( 24, bmpWriterRgb.getBitsPerPixel() );
+assertEquals( 0, bmpWriterRgb.getPaletteSize() );
+assertEquals( 16, byteArray.length );
+assertEquals( "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", 
Arrays.toString(byteArray) );
--- End diff --

Done.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127761190
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
--- End diff --

Good idea.
Done.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632776
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegmentTest.java
 ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.jpeg.segments;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link JfifSegment}.
+ *
+ * @date 13.07.2017
+ * @see JfifSegment
+ *
+ **/
+public class JfifSegmentTest{
+
+
+  @Test
+  public void testCreatesJfifSegment() {
+
+  byte[] byteArray = new byte[25];
+  JfifSegment jfifSegment = null;
+
+  try {
+jfifSegment = new JfifSegment((-2275), byteArray);
+fail("Expecting exception: Exception");
+  } catch(Throwable e) {
--- End diff --

Any reason why you want to catch all Throwables (Errors and Exceptions) 
instead of the usual Exceptions?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127633025
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
--- End diff --

InputStream is = new ByteArrayInputStream(new byte[2]);

The rest of this method doesn't care what the InputStream implementation is.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632145
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
--- End diff --

Use ISO 8601 date format (-MM-DD) to avoid ambiguity between countries 
that use MM-DD- and DD-MM-.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632387
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
+ * @see BmpWriterRgb
+ *
+ **/
+public class BmpWriterRgbTest{
+
+
+@Test
+public void testGetImageData() {
+
+BmpWriterRgb bmpWriterRgb = new BmpWriterRgb();
+BufferedImage bufferedImage = new BufferedImage(2, 2, 5);
+byte[] byteArray = bmpWriterRgb.getImageData(bufferedImage);
+
+assertEquals( 24, bmpWriterRgb.getBitsPerPixel() );
+assertEquals( 0, bmpWriterRgb.getPaletteSize() );
+assertEquals( 16, byteArray.length );
+assertEquals( "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", 
Arrays.toString(byteArray) );
--- End diff --

I'd use `assertArrayEquals( new byte[] { 0,0,0, ... }, byteArray ); ` to 
avoid string serialization issues with some locales.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632531
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

@Test(expected=NullPointerException.class)
Would be another way of writing this without the try/catch code.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632941
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
+  byteArrayInputStream.read(byteArray);
+
+  try { 
+pbmFileInfo.getRGB((InputStream) byteArrayInputStream);
--- End diff --

No need to cast


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/27


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-13 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/27

Increase code coverage one

I have created Unit Tests to increase code coverage which I want to 
contribute.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging 
increase-code-coverage-one

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/27.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #27


commit 127469460ab0ae0d12d35b4e0b5056af6debdea2
Author: Michael Hausegger 
Date:   2017-07-13T20:12:46Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit 8e48087803a12106f1d8b88803a94557f031ec62
Author: Michael Hausegger 
Date:   2017-07-13T21:00:31Z

increase-code-coverage-one Added Unit Tests to increase code coverage.




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org