You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by TheRealHaui <gi...@git.apache.org> on 2017/07/13 21:03:33 UTC

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

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 <ha...@googlemail.com>
Date:   2017-07-13T20:12:46Z

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

commit 8e48087803a12106f1d8b88803a94557f031ec62
Author: Michael Hausegger <ha...@googlemail.com>
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Where some of these generated?


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Just sent it to you via email.


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

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by jbduncan <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    @garydgregory 
    You're welcome.
    Where to send the pdf to?


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Just submitted my ICLA to secretary@apache.org.


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Improvements made in #28.


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

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Yes, you want a fresh PR.
    
    Gary
    
    On Mon, Jul 17, 2017 at 9:59 AM, TheRealHaui <no...@github.com>
    wrote:
    
    > As the pull request is already closed shall I reopen another with the same
    > name?
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/commons-imaging/pull/27#issuecomment-315813293>,
    > or mute the thread
    > <https://github.com/notifications/unsubscribe-auth/ABIfN0FQqYsvvghqfwZgLiN7RSJu1uYsks5sO5HVgaJpZM4OXiqY>
    > .
    >



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

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Under what name? Feel free to email me at ggregory@apache.org if you do not want to state your name here.


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

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    @TheRealHaui:
    
    Thank you for your PR. 
    
    This is a lot of code, I think it would be appropriate for you to file a ICLA with us. Please see  https://www.apache.org/licenses/#clas and https://www.apache.org/licenses/icla.pdf
    
    Thank you,
    Gary


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

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Please see https://www.apache.org/licenses/#submitting



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

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    As the pull request is already closed shall I reopen another with the same name?


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Well, now I did a "mvn clean verify".
    It didn't complain about anything than for too less code coverage.
    
    However, I've checked what you claimed referring the "directory structure".
    You're right.
    That's quite or better very odd.
    I don't know how this happened right now exactly.
    But - of course - I'll fix it.


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by asfgit <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by onealj <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    @garydgregory 
    Here we go, directory naming problem solved.


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    The CI fails due to the GrayscaleRountripTest which wasn't changed by me.
    As it runs locally on my side I consider the timeout problem issued by the Travis server to be a local problem of the Travis installation in conjunction with the \@Theory test that gets executed.


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

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


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

Posted by onealj <gi...@git.apache.org>.
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 (YYYY-MM-DD) to avoid ambiguity between countries that use MM-DD-YYYY and DD-MM-YYYY.


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

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


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

Posted by garydgregory <gi...@git.apache.org>.
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    Did you try a build like "mvn clean verify"?
    
    This PR format seems bogus as it contains folders like "org.apache.commons.imaging.common.itu_t4" instead "org/apache/commons/imaging/common/itu_t4"
    



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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
  
    @garydgregory 
    Thanks for your response.
    Looked over the secretary@ section ...
    
    Referring to your question if some of the tests were generated:
    I use a lot of tools on top of my IDE that advise and suggest me where and how to improve code.
    Some - like the Sonar plugin give advice concerning code improvements.
    Some like code coverage tools advice me which lines/branches of code are not covered through automated tests yet.
    And to those I sticked in the end here.


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

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


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

Posted by TheRealHaui <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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