[GitHub] commons-imaging pull request #30: add-tests

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

[GitHub] commons-imaging pull request #30: add-tests

kinow
GitHub user TheRealHaui opened a pull request:

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

    add-tests

    Added new Unit Tests.

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

    $ git pull https://github.com/TheRealHaui/commons-imaging add-tests

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

    https://github.com/apache/commons-imaging/pull/30.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 #30
   
----
commit d58de6e4e60f6f61ff8e8b37887b62914f8e19c3
Author: Michael Hausegger <[hidden email]>
Date:   2017-07-31T23:03:41Z

    add-tests Added new Unit Tests.

----


---
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 #30: add-tests

kinow
Github user TheRealHaui commented on the issue:

    https://github.com/apache/commons-imaging/pull/30
 
    Checks failed due to Travis JDK crashing not due to problems in 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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r131538887
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
    @@ -0,0 +1,49 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.pnm;
    +
    +import org.apache.commons.imaging.ImageReadException;
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +
    +/**
    + * Unit tests for class {@link PgmFileInfo}.
    + *
    + * @date 2017-08-01
    --- End diff --
   
    Not necessary I think...


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r131538871
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParserTest.java ---
    @@ -1,3 +1,19 @@
    +/*
    --- End diff --
   
    Great catch on the missing licence headers! As I'm adding comments to this PR, and I'm just passing by the component to see if it supports something that I need for a project - and am not really familiar with the code base. It may take a bit longer to merge this PR. But if you submit another one just for the headers, we can merge it pretty much immediately ;-)


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r131538915
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShortTest.java ---
    @@ -0,0 +1,55 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.tiff.taginfos;
    +
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +import java.nio.ByteOrder;
    +import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
    +
    +/**
    + * Unit tests for class {@link TagInfoByteOrShort}.
    + *
    + * @date 2017-08-01
    + * @see TagInfoByteOrShort
    + *
    + **/
    +public class TagInfoByteOrShortTest{
    +
    +  @Test
    +  public void testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayOne() {
    +      TiffDirectoryType tiffDirectoryType = TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTES;
    +      TagInfoByteOrShort tagInfoByteOrShort = new TagInfoByteOrShort("r", 500, 500, tiffDirectoryType);
    +      ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
    +      short[] shortArray = new short[2];
    +      byte[] byteArray = tagInfoByteOrShort.encodeValue(byteOrder, shortArray);
    +
    +      assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray);
    +  }
    +
    +  @Test
    +  public void testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayTwo() {
    --- End diff --
   
    Never had problems with really long test method names, but **if** it's possible to simplify the method name, I'd be +1 for that. Not thoroughly reading the tests yet.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r131538792
 
    --- Diff: pom.xml ---
    @@ -209,6 +209,12 @@
           <version>2.5</version>
           <scope>test</scope>
         </dependency>
    +    <dependency>
    --- End diff --
   
    -0 Looks like it reduces the code that needs to be written a little bit. But I'd still be keen to keep the code lengthier, but using just vanilla JUnit.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r131538892
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
    @@ -0,0 +1,49 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.pnm;
    +
    +import org.apache.commons.imaging.ImageReadException;
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +
    +/**
    + * Unit tests for class {@link PgmFileInfo}.
    + *
    + * @date 2017-08-01
    + * @see PgmFileInfo
    + *
    + **/
    +public class PgmFileInfoTest{
    +
    +  @Test(expected = ImageReadException.class)
    --- End diff --
   
    I think the IDE got confused here. Better to keep consistent with number of spaces.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132306138
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
    @@ -0,0 +1,49 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.pnm;
    +
    +import org.apache.commons.imaging.ImageReadException;
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +
    +/**
    + * Unit tests for class {@link PgmFileInfo}.
    + *
    + * @date 2017-08-01
    --- End diff --
   
    Removed the class comment.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132306981
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
    @@ -0,0 +1,49 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.pnm;
    +
    +import org.apache.commons.imaging.ImageReadException;
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +
    +/**
    + * Unit tests for class {@link PgmFileInfo}.
    + *
    + * @date 2017-08-01
    + * @see PgmFileInfo
    + *
    + **/
    +public class PgmFileInfoTest{
    +
    +  @Test(expected = ImageReadException.class)
    --- End diff --
   
    Reformatted 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 #30: add-tests

kinow
In reply to this post by kinow
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132307800
 
    --- Diff: src/test/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShortTest.java ---
    @@ -0,0 +1,55 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.imaging.formats.tiff.taginfos;
    +
    +import org.junit.Test;
    +import static org.junit.Assert.*;
    +import java.nio.ByteOrder;
    +import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
    +
    +/**
    + * Unit tests for class {@link TagInfoByteOrShort}.
    + *
    + * @date 2017-08-01
    + * @see TagInfoByteOrShort
    + *
    + **/
    +public class TagInfoByteOrShortTest{
    +
    +  @Test
    +  public void testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayOne() {
    +      TiffDirectoryType tiffDirectoryType = TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTES;
    +      TagInfoByteOrShort tagInfoByteOrShort = new TagInfoByteOrShort("r", 500, 500, tiffDirectoryType);
    +      ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
    +      short[] shortArray = new short[2];
    +      byte[] byteArray = tagInfoByteOrShort.encodeValue(byteOrder, shortArray);
    +
    +      assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray);
    +  }
    +
    +  @Test
    +  public void testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayTwo() {
    --- End diff --
   
    Renamed test methods.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132308184
 
    --- Diff: pom.xml ---
    @@ -209,6 +209,12 @@
           <version>2.5</version>
           <scope>test</scope>
         </dependency>
    +    <dependency>
    --- End diff --
   
    Well, Equalsverifier checks equals and hashCode methods soroly.
    Therefore I considered to use 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 #30: add-tests

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

    https://github.com/apache/commons-imaging/pull/30
 
    Changes incorporated.
    Build working.


---
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 #30: add-tests

kinow
In reply to this post by kinow
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132310660
 
    --- Diff: pom.xml ---
    @@ -209,6 +209,12 @@
           <version>2.5</version>
           <scope>test</scope>
         </dependency>
    +    <dependency>
    --- End diff --
   
    Indeed, and I may even use it in some projects at work. However, other commons components use - as far as I can remember - JUnit with some local helper classes for tests. So my line of thinking, is that even though it looks useful, others would have to learn and remember to use it, or eventually we would end up with calls to Equalsverifier methods, and in some other places the old way. But again, -0 is not a blocker, if others prefer to have it, I'm fine with 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 pull request #30: add-tests

kinow
In reply to this post by kinow
Github user TheRealHaui commented on a diff in the pull request:

    https://github.com/apache/commons-imaging/pull/30#discussion_r132311416
 
    --- Diff: pom.xml ---
    @@ -209,6 +209,12 @@
           <version>2.5</version>
           <scope>test</scope>
         </dependency>
    +    <dependency>
    --- End diff --
   
    Understand your point.


---
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]

Loading...