|
21 | 21 | import java.io.File;
|
22 | 22 | import java.net.URISyntaxException;
|
23 | 23 |
|
| 24 | +import org.eclipse.esmf.aspectmodel.AspectLoadingException; |
24 | 25 | import org.eclipse.esmf.aspectmodel.loader.AspectModelLoader;
|
25 | 26 | import org.eclipse.esmf.aspectmodel.resolver.exceptions.ModelResolutionException;
|
26 |
| -import org.eclipse.esmf.aspectmodel.resolver.services.TurtleLoader; |
27 | 27 | import org.eclipse.esmf.aspectmodel.urn.AspectModelUrn;
|
28 | 28 | import org.eclipse.esmf.metamodel.AspectModel;
|
29 | 29 | import org.eclipse.esmf.metamodel.vocabulary.SammNs;
|
30 | 30 | import org.eclipse.esmf.samm.KnownVersion;
|
| 31 | +import org.eclipse.esmf.test.InvalidTestAspect; |
31 | 32 | import org.eclipse.esmf.test.TestModel;
|
| 33 | +import org.eclipse.esmf.test.TestResources; |
32 | 34 |
|
33 |
| -import org.apache.jena.rdf.model.Model; |
34 | 35 | import org.apache.jena.rdf.model.Resource;
|
35 | 36 | import org.apache.jena.vocabulary.RDF;
|
36 | 37 | import org.junit.jupiter.api.Test;
|
37 | 38 |
|
38 |
| -public class AspectModelResolverTest { |
| 39 | +class AspectModelResolverTest { |
39 | 40 | @Test
|
40 | 41 | void testLoadDataModelExpectSuccess() throws URISyntaxException {
|
41 | 42 | final File aspectModelsRootDirectory = new File(
|
@@ -118,13 +119,6 @@ void testResolveReferencedModelFromMemoryExpectSuccess() throws URISyntaxExcepti
|
118 | 119 |
|
119 | 120 | final ResolutionStrategy urnStrategy = new FileSystemStrategy( aspectModelsRootDirectory.toPath() );
|
120 | 121 |
|
121 |
| - final AspectModelUrn inputUrn = AspectModelUrn |
122 |
| - .fromUrn( TestModel.TEST_NAMESPACE + "AnotherTest" ); |
123 |
| - final Model model = TurtleLoader.loadTurtle( |
124 |
| - AspectModelResolverTest.class.getResourceAsStream( |
125 |
| - "/" + KnownVersion.getLatest().toString().toLowerCase() |
126 |
| - + "/org.eclipse.esmf.test/1.0.0/Test.ttl" ) ).get(); |
127 |
| - |
128 | 122 | final ResolutionStrategy inMemoryStrategy = new FromLoadedFileStrategy( AspectModelFileLoader.load(
|
129 | 123 | AspectModelResolverTest.class.getResourceAsStream(
|
130 | 124 | "/" + KnownVersion.getLatest().toString().toLowerCase()
|
@@ -193,4 +187,15 @@ void testResolutionMissingModelElementExpectFailure() throws Throwable {
|
193 | 187 | final AspectModel result = new AspectModelLoader( urnStrategy ).load( testUrn );
|
194 | 188 | } ).isInstanceOf( ModelResolutionException.class );
|
195 | 189 | }
|
| 190 | + |
| 191 | + @Test |
| 192 | + void getExceptionWhileLoadingModelWithTwoAspects() { |
| 193 | + assertThatThrownBy( () -> { |
| 194 | + TestResources.load( InvalidTestAspect.INVALID_ASPECT_WITH_TWO_ASPECTS ); |
| 195 | + } ) |
| 196 | + .isInstanceOf( AspectLoadingException.class ) |
| 197 | + .hasMessageContaining( |
| 198 | + "Aspect model file testmodel:invalid/org.eclipse.esmf.test/1.0.0/InvalidAspectWithTwoAspects.ttl contains 2 " |
| 199 | + + "aspects, but may only contain one." ); |
| 200 | + } |
196 | 201 | }
|
0 commit comments