Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion org.modeldriven.alf.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
<artifactId>org.modeldriven.alf</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src-tests</testSourceDirectory>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright 2019-2020 Model Driven Solutions, Inc.
* All rights reserved worldwide. This program and the accompanying materials
* are made available for use under the terms of the GNU General Public License
* (GPL) version 3 that accompanies this distribution and is available at
* http://www.gnu.org/licenses/gpl-3.0.html. For alternative licensing terms,
* contact Model Driven Solutions.
*******************************************************************************/
package org.modeldriven.alf;

import static org.junit.jupiter.api.Assertions.*;

import java.util.Arrays;
import java.util.List;

import java.util.stream.Stream;

import org.junit.jupiter.api.Test;

import org.modeldriven.alf.uml.ElementFactory;

import org.apache.commons.lang3.tuple.Pair;

public class ElementFactoryTest {
@Test
void simple() {

List<Pair<String, String>> classNames = Arrays.asList(
Pair.<String, String>of("Package", "Package"),
Pair.<String, String>of("Class", "Class_"),
Pair.<String, String>of("Classifier", "Classifier"),
Pair.<String, String>of("Activity", "Activity")
);
classNames.stream().forEach(expectation -> {
Class<?> javaInterface = ElementFactory.interfaceForName(expectation.getLeft());
assertNotNull(javaInterface);
assertEquals(expectation.getRight(), javaInterface.getSimpleName());
assertTrue(javaInterface.isInterface());
});

assertNull(ElementFactory.interfaceForName("Foo"));
}
}