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

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
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 <[hidden email]>
Date:   2017-07-13T20:12:46Z

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

commit 8e48087803a12106f1d8b88803a94557f031ec62
Author: Michael Hausegger <[hidden email]>
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
 
    Just submitted my ICLA to [hidden 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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
Github user garydgregory commented on the issue:

    https://github.com/apache/commons-imaging/pull/27
 
    Under what name? Feel free to email me at [hidden email] 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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

mureinik
In reply to this post by mureinik
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12
Loading...