-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
e8ba1f3
commit 1a003d8
Showing
11 changed files
with
131 additions
and
9 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
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
15 changes: 15 additions & 0 deletions
15
...rizr-component/src/test/java/com/structurizr/component/filter/DefaultTypeFilterTests.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.filter; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class DefaultTypeFilterTests { | ||
|
||
@Test | ||
void filter_ReturnsTrue() { | ||
assertTrue(new DefaultTypeFilter().accept(new Type("com.example.Class"))); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...ent/src/test/java/com/structurizr/component/filter/ExcludeAbstractClassesFilterTests.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,31 @@ | ||
package com.structurizr.component.filter; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ExcludeAbstractClassesFilterTests { | ||
|
||
@Test | ||
void filter_ReturnsTrue_WhenTheTypeIsNotAbstract() { | ||
assertTrue(new ExcludeAbstractClassesTypeFilter().accept(new Type("com.example.Class") { | ||
@Override | ||
public boolean isAbstractClass() { | ||
return false; | ||
} | ||
})); | ||
} | ||
|
||
@Test | ||
void filter_ReturnsFalse_WhenTheTypeIsAbstract() { | ||
assertFalse(new ExcludeAbstractClassesTypeFilter().accept(new Type("com.example.Class") { | ||
@Override | ||
public boolean isAbstractClass() { | ||
return true; | ||
} | ||
})); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...ponent/src/test/java/com/structurizr/component/filter/ExcludeTypesByRegexFilterTests.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,32 @@ | ||
package com.structurizr.component.filter; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class ExcludeTypesByRegexFilterTests { | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedANullSuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new ExcludeTypesByRegexFilter(null)); | ||
} | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedAnEmptySuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new ExcludeTypesByRegexFilter("")); | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new ExcludeTypesByRegexFilter(" ")); | ||
} | ||
|
||
|
||
@Test | ||
void filter_ReturnsTrue_WhenTheTypeDoesNotMatchRegex() { | ||
assertTrue(new ExcludeTypesByRegexFilter(".*Utils").accept(new Type("com.example.CustomerComponent"))); | ||
} | ||
|
||
@Test | ||
void filter_ReturnsFalse_WhenTheTypeMatchesRegex() { | ||
assertFalse(new ExcludeTypesByRegexFilter(".*Utils").accept(new Type("com.example.DateUtils"))); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...ponent/src/test/java/com/structurizr/component/filter/IncludeTypesByRegexFilterTests.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,32 @@ | ||
package com.structurizr.component.filter; | ||
|
||
import com.structurizr.component.Type; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class IncludeTypesByRegexFilterTests { | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedANullSuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new IncludeTypesByRegexFilter(null)); | ||
} | ||
|
||
@Test | ||
void construction_ThrowsAnException_WhenPassedAnEmptySuffix() { | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new IncludeTypesByRegexFilter("")); | ||
assertThrowsExactly(IllegalArgumentException.class, () -> new IncludeTypesByRegexFilter(" ")); | ||
} | ||
|
||
|
||
@Test | ||
void filter_ReturnsFalse_WhenTheTypeDoesNotMatchRegex() { | ||
assertFalse(new IncludeTypesByRegexFilter(".*Component").accept(new Type("com.example.DateUtils"))); | ||
} | ||
|
||
@Test | ||
void filter_ReturnsTrue_WhenTheTypeMatchesRegex() { | ||
assertTrue(new IncludeTypesByRegexFilter(".*Component").accept(new Type("com.example.CustomerComponent"))); | ||
} | ||
|
||
} |