/*
 * Copyright 2012 Daniel Bechler
 *
 * 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.
 */

package de.danielbechler.diff.integration;

import de.danielbechler.diff.*;
import de.danielbechler.diff.mock.*;
import de.danielbechler.diff.node.*;
import org.testng.annotations.*;

import static de.danielbechler.diff.node.NodeAssertions.*;

/** @author Daniel Bechler */
public class AdditionIntegrationTest
{
	@Test
	public void testDetectsChangeFromNullToObjectReferenctAsAddition() throws Exception
	{
		final ObjectWithString base = new ObjectWithString();
		final ObjectWithString working = new ObjectWithString("foo");

		final Node node = ObjectDifferFactory.getInstance().compare(working, base);

		assertThat(node).child("value").hasState(Node.State.ADDED);
	}
}

@@ -830,16 +830,67 @@
 tions.*;
+%0Aimport static org.testng.AssertJUnit.assertEquals;
 %0A%0A/** @a
@@ -1311,11 +1311,901 @@
 DED);%0A%09%7D
+%0A%0A    @Test%0A    public void testDetectsChangeForDuplicatesInList() throws Exception%0A    %7B%0A        final Contact joe = new Contact(%22Joe%22, %22Smith%22);%0A        final PhoneBook phoneBookServer = new PhoneBook(%22devs%22);%0A        phoneBookServer.addContact(joe);%0A        final PhoneBook phoneBookMobile = new PhoneBook(%22devs%22);%0A        phoneBookMobile.addContact(joe);%0A%0A        assertEquals(Node.State.UNTOUCHED, ObjectDifferFactory.getInstance().compare(phoneBookMobile, phoneBookServer).getState());%0A        phoneBookMobile.addContact(joe);%0A        assertEquals(2, phoneBookMobile.getContacts().size());%0A        //Should be ADDED!%0A        //assertEquals(Node.State.ADDED, ObjectDifferFactory.getInstance().compare(phoneBookMobile, phoneBookServer).getState());%0A        assertEquals(Node.State.UNTOUCHED, ObjectDifferFactory.getInstance().compare(phoneBookMobile, phoneBookServer).getState());%0A    %7D
 %0A%7D%0A

Add test for duplicates in list