-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
f378637
commit 4bab88f
Showing
10 changed files
with
151 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
36 changes: 36 additions & 0 deletions
36
...component/src/test/java/com/structurizr/component/matcher/NameSuffixTypeMatcherTests.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,36 @@ | ||
package com.structurizr.component.matcher; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class NameSuffixTypeMatcherTests { | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedANullSuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new NameSuffixTypeMatcher(null, "Technology")); | ||
} | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedAnEmptySuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new NameSuffixTypeMatcher("", "Technology")); | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new NameSuffixTypeMatcher(" ", "Technology")); | ||
} | ||
|
||
@Test | ||
void matches_ThrowsAnException_WhenPassedNull() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new NameSuffixTypeMatcher("Suffix", "Technology").matches(null)); | ||
} | ||
|
||
@Test | ||
void matches_ReturnsFalse_WhenThereIsNoMatch() { | ||
assertFalse(new NameSuffixTypeMatcher("Component", "Technology").matches(new Type("com.example.SomeClass"))); | ||
} | ||
|
||
@Test | ||
void matches_ReturnsTrue_WhenThereIsAMatch() { | ||
assertTrue(new NameSuffixTypeMatcher("Component", "Technology").matches(new Type("com.example.SomeComponent"))); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...omponent/src/test/java/com/structurizr/component/matcher/RegexSuffixTypeMatcherTests.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,36 @@ | ||
package com.structurizr.component.matcher; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class RegexSuffixTypeMatcherTests { | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedANullRegex() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new RegexTypeMatcher(null, "Technology")); | ||
} | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedAnEmptyRegex() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new RegexTypeMatcher("", "Technology")); | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new RegexTypeMatcher(" ", "Technology")); | ||
} | ||
|
||
@Test | ||
void matches_ThrowsAnException_WhenPassedNull() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new RegexTypeMatcher(".*Controller", "Technology").matches(null)); | ||
} | ||
|
||
@Test | ||
void matches_ReturnsFalse_WhenThereIsNoMatch() { | ||
assertFalse(new RegexTypeMatcher(".*Controller", "Technology").matches(new Type("com.example.SomeClass"))); | ||
} | ||
|
||
@Test | ||
void matches_ReturnsTrue_WhenThereIsAMatch() { | ||
assertTrue(new RegexTypeMatcher(".*Controller", "Technology").matches(new Type("com.example.SomeController"))); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...-component/src/test/java/com/structurizr/component/naming/DefaultNamingStrategyTests.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,15 @@ | ||
package com.structurizr.component.naming; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class DefaultNamingStrategyTests { | ||
|
||
@Test | ||
void nameOf() { | ||
assertEquals("Class Name", new DefaultNamingStrategy().nameOf(new Type("com.example.ClassName"))); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...ent/src/test/java/com/structurizr/component/naming/FullyQualifiedNamingStrategyTests.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,15 @@ | ||
package com.structurizr.component.naming; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class FullyQualifiedNamingStrategyTests { | ||
|
||
@Test | ||
void nameOf() { | ||
assertEquals("com.example.ClassName", new FullyQualifiedNamingStrategy().nameOf(new Type("com.example.ClassName"))); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...r-component/src/test/java/com/structurizr/component/naming/SimpleNamingStrategyTests.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,15 @@ | ||
package com.structurizr.component.naming; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class SimpleNamingStrategyTests { | ||
|
||
@Test | ||
void nameOf() { | ||
assertEquals("ClassName", new SimpleNamingStrategy().nameOf(new Type("com.example.ClassName"))); | ||
} | ||
|
||
} |