StefanOltmann commented on code in PR #366:
URL: https://github.com/apache/commons-imaging/pull/366#discussion_r1518984347


##########
src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputFieldTestUtil.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.write;
+
+public class TiffOutputFieldTestUtil {

Review Comment:
   Sorry, but I can't follow you here.
   
   The main issue is that the field `TiffOutputField.bytes` is private because 
it's an array that could be changed from outside the class. In Java we don't 
have immutable byte arrays unfortunately.
   
   So the original `bytesEqual()` was created to compare an arbitrary byte 
array with the contents of the TiffOutputField. This is used in production code 
where the MakerNote protection is effective.
   
   What we really need to test is a way to tell if two TiffOutputFields have 
the same content. There isn't a suitable other way to do so.
   
   As you did not want to have additional public API this new class uses the 
package private way to access it from the test.
   
   Another option would be to move the test into the same package.
   
   But as I did not write the original test and did not want to change too 
much, I did not move it. Moving it would be a better option IMHO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to