package org.verapdf.model.impl.pb.pd;

import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.impl.BaseTest;
import org.verapdf.model.impl.pb.pd.actions.PBoxPDAction;
import org.verapdf.model.impl.pb.pd.actions.PBoxPDNamedAction;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;

/**
 * @author Evgeniy Muravitskiy
 */
public class PBoxPDOutlineTest extends BaseTest {

	public static final String FILE_RELATIVE_PATH = "cos/veraPDF test suite 6-1-2-t02-fail-a.pdf";

	@BeforeClass
	public static void setUp() throws URISyntaxException, IOException {
		expectedType = TYPES.contains(PBoxPDOutline.OUTLINE_TYPE) ? PBoxPDOutline.OUTLINE_TYPE : null;
		expectedID = null;

		setUp(FILE_RELATIVE_PATH);
		PDOutlineItem firstChild = document.getDocumentCatalog().getDocumentOutline().getFirstChild();
		actual = new PBoxPDOutline(firstChild);
	}

	@Test
	public void testActionLink() {
		List<? extends org.verapdf.model.baselayer.Object> action = actual.getLinkedObjects(PBoxPDOutline.ACTION);
		Assert.assertEquals(0, action.size());
		for (Object object : action) {
			Assert.assertTrue(PBoxPDAction.ACTION_TYPE.equals(object.getObjectType()) ||
					PBoxPDNamedAction.NAMED_ACTION_TYPE.equals(object.getObjectType()));
		}
	}

}

@@ -400,16 +400,60 @@
 dAction;
+%0Aimport org.verapdf.model.tools.IDGenerator;
 %0A%0Aimport
@@ -916,20 +916,29 @@
 tedID = 
-null
+%22outline 6 0%22
 ;%0A%0A%09%09set
@@ -1097,16 +1097,52 @@
 rstChild
+, IDGenerator.generateID(firstChild)
 );%0A%09%7D%0A%0A%09

Fix outlines unit test