-
-
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.
- Loading branch information
1 parent
db3da9b
commit f378637
Showing
6 changed files
with
123 additions
and
21 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
23 changes: 23 additions & 0 deletions
23
structurizr-component/src/test/java/com/structurizr/component/TypeTests.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,23 @@ | ||
package com.structurizr.component; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class TypeTests { | ||
|
||
private Type type; | ||
|
||
@Test | ||
void name() { | ||
type = new Type("com.example.ClassName"); | ||
assertEquals("ClassName", type.getName()); | ||
} | ||
|
||
@Test | ||
void packageName() { | ||
type = new Type("com.example.ClassName"); | ||
assertEquals("com.example", type.getPackageName()); | ||
} | ||
|
||
} |
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
29 changes: 29 additions & 0 deletions
29
...izr/component/supporting/AllReferencedTypesInSamePackageSupportingTypesStrategyTests.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,29 @@ | ||
package com.structurizr.component.supporting; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Set; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class AllReferencedTypesInSamePackageSupportingTypesStrategyTests { | ||
|
||
@Test | ||
void findSupportingTypes() { | ||
Type type = new Type("com.example.a.A"); | ||
|
||
Type dependency1 = new Type("com.example.a.AImpl"); | ||
Type dependency2 = new Type("com.example.util.SomeUtils"); | ||
type.addDependency(dependency1); | ||
type.addDependency(dependency2); | ||
|
||
type.addDependency(new Type("com.example.util.SomeUtils")); | ||
|
||
Set<Type> supportingTypes = new AllReferencedTypesInSamePackageSupportingTypesStrategy().findSupportingTypes(type); | ||
assertEquals(1, supportingTypes.size()); | ||
assertTrue(supportingTypes.contains(dependency1)); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
.../com/structurizr/component/supporting/AllReferencedTypesSupportingTypesStrategyTests.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,30 @@ | ||
package com.structurizr.component.supporting; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Set; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class AllReferencedTypesSupportingTypesStrategyTests { | ||
|
||
@Test | ||
void findSupportingTypes() { | ||
Type type = new Type("com.example.a.A"); | ||
|
||
Type dependency1 = new Type("com.example.a.AImpl"); | ||
Type dependency2 = new Type("com.example.util.SomeUtils"); | ||
type.addDependency(dependency1); | ||
type.addDependency(dependency2); | ||
|
||
type.addDependency(new Type("com.example.util.SomeUtils")); | ||
|
||
Set<Type> supportingTypes = new AllReferencedTypesSupportingTypesStrategy().findSupportingTypes(type); | ||
assertEquals(2, supportingTypes.size()); | ||
assertTrue(supportingTypes.contains(dependency1)); | ||
assertTrue(supportingTypes.contains(dependency2)); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...c/test/java/com/structurizr/component/supporting/DefaultSupportingTypesStrategyTests.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,21 @@ | ||
package com.structurizr.component.supporting; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Set; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class DefaultSupportingTypesStrategyTests { | ||
|
||
@Test | ||
void findSupportingTypes() { | ||
Type type = new Type("com.example.a.A"); | ||
type.addDependency(new Type("com.example.a.AImpl")); | ||
|
||
Set<Type> supportingTypes = new DefaultSupportingTypesStrategy().findSupportingTypes(type); | ||
assertTrue(supportingTypes.isEmpty()); | ||
} | ||
|
||
} |