blob: b3054732d3e5bc9ac62ccff8b2f9c575a144c6ed [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 The University of York.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Louis Rose - initial API and implementation
******************************************************************************
*
* $Id$
*/
package org.eclipse.epsilon.flock.model.checker;
import static org.mockito.Mockito.*;
import org.eclipse.epsilon.flock.context.MigrationStrategyCheckingContext;
import org.eclipse.epsilon.flock.execution.exceptions.FlockRuntimeException;
import org.junit.Test;
public class IgnoredPropertiesCheckerTests {
private final MigrationStrategyCheckingContext context = mock(MigrationStrategyCheckingContext.class);
@Test
public void ignoringAnUnknownPropertyProducesAWarning() throws FlockRuntimeException {
when(context.isPropertyInOriginalMetamodel("Person", "unknownProperty"))
.thenReturn(false);
new IgnoredPropertyChecker("Person", context).check("unknownProperty");
verify(context).addWarning("The unknownProperty property should be ignored, " +
"but there is no unknownProperty property defined for Person in the original metamodel.");
}
@Test
public void ignoringAnKnownPropertyDoesNotProduceAWarning() throws FlockRuntimeException {
when(context.isPropertyInOriginalMetamodel("Person", "knownProperty"))
.thenReturn(true);
new IgnoredPropertyChecker("Person", context).check("knownProperty");
verify(context, never()).addWarning(anyString());
}
}