-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add classpath scan packages intersection validation
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
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
34 changes: 34 additions & 0 deletions
34
src/test/groovy/ru/vyarus/dropwizard/guice/unit/PackagesValidationTest.groovy
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,34 @@ | ||
package ru.vyarus.dropwizard.guice.unit | ||
|
||
import ru.vyarus.dropwizard.guice.AbstractTest | ||
import ru.vyarus.dropwizard.guice.module.installer.scanner.ClasspathScanner | ||
|
||
/** | ||
* @author Vyacheslav Rusakov | ||
* @since 01.10.2015 | ||
*/ | ||
class PackagesValidationTest extends AbstractTest { | ||
|
||
def "Check packages integrity validation"() { | ||
|
||
when: "duplicate subpackage" | ||
new ClasspathScanner(['com.pack', 'com.pack.sub'] as Set) | ||
then: "not allowed" | ||
thrown(IllegalStateException) | ||
|
||
when: "duplicate subpackage inverse order" | ||
new ClasspathScanner(['com.pack.sub', 'com.pack'] as Set) | ||
then: "not allowed" | ||
thrown(IllegalStateException) | ||
|
||
when: "valid packages" | ||
new ClasspathScanner(['com.pack.sub', 'com.pack.sub2', 'com.pack.sub3.foo'] as Set) | ||
then: "valid" | ||
true | ||
|
||
when: "duplicate subpackage" | ||
new ClasspathScanner(['com.pack.sub', 'com.pack.sub2', 'com.pack.sub3.foo', 'com.pack.sub.bar'] as Set) | ||
then: "not allowed" | ||
thrown(IllegalStateException) | ||
} | ||
} |