package com.izforge.izpack.compiler.packager.impl;

import static org.junit.Assert.fail;

import java.io.IOException;

import org.dom4j.dom.DOMElement;
import org.junit.Test;
import org.mockito.Mockito;

import com.izforge.izpack.api.adaptator.IXMLElement;
import com.izforge.izpack.api.adaptator.impl.XMLElementImpl;
import com.izforge.izpack.compiler.resource.ResourceFinder;
import com.izforge.izpack.merge.MergeManager;

public class PackagerTest {

	@Test
	public void testWritePacks() throws IOException {
		final ResourceFinder resourceFinder = new ResourceFinder(null, null,
				null, null) {
			@Override
			public IXMLElement getXMLTree() throws IOException {
				final DOMElement rootNode = new DOMElement("installation");
				final DOMElement guiPrefsNode = new DOMElement("guiprefs");
				rootNode.add(guiPrefsNode);
				return new XMLElementImpl(rootNode);
			}
		};
		final MergeManager mockMergeManager = Mockito.mock(MergeManager.class);
		final Packager packager = new Packager(null, null, null, null, null,
				null, null, mockMergeManager, null, null, null, resourceFinder);
		packager.writeManifest();
		fail("Not yet implemented");
	}

}

@@ -67,25 +67,116 @@
 org.
-junit.Assert.fail
+mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.verify
 ;%0A%0Ai
@@ -232,24 +232,24 @@
 DOMElement;%0A
+
 import org.j
@@ -262,36 +262,8 @@
 est;
-%0Aimport org.mockito.Mockito;
 %0A%0Aim
@@ -977,24 +977,16 @@
 nager = 
-Mockito.
 mock(Mer
@@ -1003,16 +1003,17 @@
 class);%0A
+%0A
 %09%09final 
@@ -1144,16 +1144,17 @@
 inder);%0A
+%0A
 %09%09packag
@@ -1177,41 +1177,84 @@
 ();%0A
+%0A
 %09%09
-fail(%22Not yet implemented%22
+verify(mockMergeManager).addResourceToMerge(anyString(), anyString()
 );%0A
+%0A
 %09%7D%0A
-%0A
 %7D%0A

Check if MergeManager's addResourceToMerge(String, String) had been called