org.eclipse.uml2.uml.Package
testSuite = UMLFactory.eINSTANCE.createPackage();
resource.getContents().add(testSuite);
testSuite.addKeyword("testSuite");
testSuite.setName("FeatherweightTests");
org.eclipse.uml2.uml.Class
testContext = testSuite.createOwnedClass("FeatherweightExample", false);
testContext.addKeyword("testContext");
Operation testCase =
testContext.createOwnedOperation("testExtension", null, null);
testCase.addKeyword("testCase");
Comment objective =
testCase.createOwnedComment();
objective.addKeyword("objective");
objective.getAnnotatedElements().add(testCase);
objective.setBody("Test
featherweight extension of UML2.");