/*
 * Copyright 2002-2015 Drew Noakes
 *
 *    Licensed 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.
 *
 * More information about this project is available at:
 *
 *    https://drewnoakes.com/code/exif/
 *    https://github.com/drewnoakes/metadata-extractor
 */

package com.drew.metadata.icc;

import com.drew.lang.ByteArrayReader;
import com.drew.metadata.Metadata;
import com.drew.testing.TestHelper;
import com.drew.tools.FileUtil;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;

public class IccReaderTest
{
    @Test
    public void testExtract() throws Exception
    {
        byte[] app2Bytes = FileUtil.readBytes("Tests/Data/iccDataInvalid1.jpg.app2");

        // ICC data starts after a 14-byte preamble
        byte[] icc = TestHelper.skipBytes(app2Bytes, 14);

        Metadata metadata = new Metadata();
        new IccReader().extract(new ByteArrayReader(icc), metadata);

        IccDirectory directory = metadata.getFirstDirectoryOfType(IccDirectory.class);

        assertNotNull(directory);

        // TODO validate expected values

//        for (Tag tag : directory.getTags()) {
//            System.out.println(tag);
//        }
    }
}

@@ -810,16 +810,62 @@
 a.icc;%0A%0A
+import com.drew.imaging.jpeg.JpegSegmentType;%0A
 import c
@@ -1021,16 +1021,42 @@
 .Test;%0A%0A
+import java.util.Arrays;%0A%0A
 import s
@@ -1097,37 +1097,167 @@
 ll;%0A
-%0Apublic class IccReaderTest%0A%7B
+import static org.junit.Assert.assertTrue;%0A%0Apublic class IccReaderTest%0A%7B%0A    // TODO add a test with well-formed ICC data and assert output values are correct%0A
 %0A   
@@ -1290,16 +1290,28 @@
 tExtract
+_InvalidData
 () throw
@@ -1425,16 +1425,41 @@
       //
+ When in an APP2 segment,
  ICC dat
@@ -1791,148 +1791,504 @@
 y);%0A
+        assertTrue(directory.hasErrors());
 %0A    
+%7D%0A%0A
     
-// TODO 
+@Test%0A    public void testReadJpegSegments_In
 valid
+D
 at
-e expected values%0A%0A//        for (Tag tag : directory.getTags()) %7B%0A//            System.out.println(tag
+a() throws Exception%0A    %7B%0A        byte%5B%5D app2Bytes = FileUtil.readBytes(%22Tests/Data/iccDataInvalid1.jpg.app2%22);%0A%0A        Metadata metadata = new Metadata();%0A        new IccReader().readJpegSegments(Arrays.asList(app2Bytes), metadata, JpegSegmentType.APP2);%0A%0A        IccDirectory directory = metadata.getFirstDirectoryOfType(IccDirectory.class);%0A%0A        assertNotNull(directory
 );%0A
-//
         
 %7D%0A  
@@ -2283,17 +2283,50 @@
         
-%7D
+assertTrue(directory.hasErrors());
 %0A    %7D%0A%7D

Make IccReaderTest clearer and add a TODO.