/*
Copyright (C) 2010 by Claas Wilke (claas.wilke@tu-dresden.de)
This file is part of the PAIN Case Study of Dresden OCL2 for Eclipse.
Dresden OCL2 for Eclipse is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.
Dresden OCL2 for Eclipse is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License along
with Dresden OCL2 for Eclipse. If not, see <http://www.gnu.org/licenses/>.
*/
package org.dresdenocl.interpreter.test.standardlibrary;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.dresdenocl.interpreter.IInterpretationResult;
import org.dresdenocl.model.ModelAccessException;
import org.dresdenocl.parser.ParseException;
/**
* <p>
* Contains some test cases to test Standard Library operations on
* <code>OrderedSets</code>s.
* </p>
*
* @author Claas Wilke
*/
public class TestOrderedSet extends AbstractInterpreterTest {
/** The name of the constraint directory for this test suite. */
private static final String CONSTRAINT_DIRECTORY = "standardlibrary/orderedset";
/**
* <p>
* Tests the operation <code>Collection.product(Collection)</code>.
* </p>
*
* @throws ParseException
* @throws ModelAccessException
* @throws IllegalArgumentException
*/
@Test
public void testEquals01() throws IllegalArgumentException,
ModelAccessException, ParseException {
List<IInterpretationResult> results;
results = super.interpretConstraintsForInstance(MODEL1_NAME,
CONSTRAINT_DIRECTORY + "/equals01", INSTANCE1_NAME, Arrays
.asList(new String[] { "Class1" }));
assertNotNull(results);
assertEquals(1, results.size());
this.assertIsTrue(results.get(0));
}
/**
* <p>
* Tests the operation <code>Collection.product(Collection)</code>.
* </p>
*
* @throws ParseException
* @throws ModelAccessException
* @throws IllegalArgumentException
*/
@Test
public void testEqualsNegative01() throws IllegalArgumentException,
ModelAccessException, ParseException {
List<IInterpretationResult> results;
results = super.interpretConstraintsForInstance(MODEL1_NAME,
CONSTRAINT_DIRECTORY + "/equalsNegative01", INSTANCE1_NAME, Arrays
.asList(new String[] { "Class1" }));
assertNotNull(results);
assertEquals(1, results.size());
this.assertIsFalse(results.get(0));
}
}