/*
Copyright (C) 2008-2009 by Claas Wilke (claaswilke@gmx.net)
This file is part of the OCL2 Parser Test Suite 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.ocl2parser.test.standardlibrary;
import org.junit.Test;
import org.dresdenocl.ocl2parser.test.TestPerformer;
import org.dresdenocl.parser.SemanticException;
/**
* <p>
* Contains test cases that check that all operations defined on the type
* OrderedSet are parsed appropriately.
* </p>
*
* @author Claas Wilke
*/
public class TestOrderedSet {
/**
* <p>
* A test case testing the method <code>OrderedSet->append(T)</code>.
* </p>
*/
@Test
public void testAppendPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/appendPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->append(T)</code>.
* </p>
*/
@Test(expected = SemanticException.class)
public void testAppendNegative01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/appendNegative01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->at(Integer)</code>.
* </p>
*/
@Test
public void testAtPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/atPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->at(Integer)</code>.
* </p>
*/
@Test
public void testAtPositive02() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/atPositive02.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->first()</code>.
* </p>
*/
@Test
public void testFirstPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/firstPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->indexOf(Integer)</code>.
* </p>
*/
@Test
public void testIndexOfPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/indexOfPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->indexOf(Integer)</code>.
* </p>
*/
@Test(expected = SemanticException.class)
public void testIndexOfNegative01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/indexOfNegative01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method
* <code>OrderedSet->insertAt(Integer, T)</code>.
* </p>
*/
@Test
public void testInsertAtPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/insertAtPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method
* <code>OrderedSet->insertAt(Integer, T)</code>.
* </p>
*/
@Test
public void testInsertAtPositive02() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/insertAtPositive02.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method
* <code>OrderedSet->insertAt(Integer, T)</code>.
* </p>
*/
@Test(expected = SemanticException.class)
public void testInsertAtNegative01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/insertAtNegative01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->last()</code>.
* </p>
*/
@Test
public void testLastPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/lastPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->prepend(T)</code>.
* </p>
*/
@Test
public void testPrependPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/prependPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->reverse()</code>.
* </p>
*/
@Test
public void testReversePositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/reversePositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method <code>OrderedSet->prepend(T)</code>.
* </p>
*/
@Test(expected = SemanticException.class)
public void testPrependNegative01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/prependNegative01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method
* <code>OrderedSet->subOrderedSet(Integer, Integer)</code>.
* </p>
*/
@Test
public void testSubOrderedSetPositive01() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/subOrderedSetPositive01.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
/**
* <p>
* A test case testing the method
* <code>OrderedSet->subOrderedSet(Integer, Integer)</code>.
* </p>
*/
@Test
public void testSubOrderedSetPositive02() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/orderedset/subOrderedSetPositive02.ocl";
modelFileName = "testmodel.uml";
/* Try to get the TestPerformer. */
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
/* Try to parse the constraint file. */
testPerformer.parseFile(oclFileName);
}
}