-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It now doesn't matter to the component finder what the ordering of so…
…urce or class type providers is.
- Loading branch information
1 parent
3c83773
commit 12ddd83
Showing
6 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
structurizr-component/src/test/java/com/structurizr/component/TypeRepositoryTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.structurizr.component; | ||
|
||
import org.apache.bcel.classfile.ClassParser; | ||
import org.apache.bcel.classfile.JavaClass; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertSame; | ||
|
||
public class TypeRepositoryTests { | ||
|
||
@Test | ||
void add_MergesClassInformation() throws Exception { | ||
String fqn = "com.structurizr.component.TypeRepositoryTests"; | ||
File classes = new File("build/classes/java/test"); | ||
ClassParser parser = new ClassParser(new File(classes, "com/structurizr/component/TypeRepositoryTests.class").getAbsolutePath()); | ||
JavaClass javaClass = parser.parse(); | ||
|
||
Type classType = new Type(javaClass); | ||
Type sourceType = new Type(fqn); | ||
sourceType.setSource("source path"); | ||
|
||
TypeRepository typeRepository = new TypeRepository(); | ||
typeRepository.add(sourceType); // source first | ||
typeRepository.add(classType); | ||
|
||
assertSame(javaClass, typeRepository.getType(fqn).getJavaClass()); | ||
assertEquals("source path", typeRepository.getType(fqn).getSource()); | ||
} | ||
|
||
@Test | ||
void add_MergesSourceInformation() throws Exception { | ||
String fqn = "com.structurizr.component.TypeRepositoryTests"; | ||
File classes = new File("build/classes/java/test"); | ||
ClassParser parser = new ClassParser(new File(classes, "com/structurizr/component/TypeRepositoryTests.class").getAbsolutePath()); | ||
JavaClass javaClass = parser.parse(); | ||
|
||
Type classType = new Type(javaClass); | ||
Type sourceType = new Type(fqn); | ||
sourceType.setSource("source path"); | ||
|
||
TypeRepository typeRepository = new TypeRepository(); | ||
typeRepository.add(classType); // class first | ||
typeRepository.add(sourceType); | ||
|
||
assertSame(javaClass, typeRepository.getType(fqn).getJavaClass()); | ||
assertEquals("source path", typeRepository.getType(fqn).getSource()); | ||
} | ||
|
||
} |