-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.enofex.taikai; | ||
|
||
import com.tngtech.archunit.core.domain.JavaClasses; | ||
import com.tngtech.archunit.core.importer.ClassFileImporter; | ||
import com.tngtech.archunit.core.importer.ImportOption; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class NamespaceTest { | ||
|
||
private static final String VALID_NAMESPACE = "com.enofex.taikai"; | ||
|
||
@Test | ||
void shouldReturnJavaClassesWithoutTests() { | ||
JavaClasses result = Namespace.from(VALID_NAMESPACE, Namespace.IMPORT.WITHOUT_TESTS); | ||
|
||
assertNotNull(result); | ||
assertDoesNotThrow(() -> new ClassFileImporter() | ||
.withImportOption(new ImportOption.DoNotIncludeTests()) | ||
.withImportOption(new ImportOption.DoNotIncludeJars()) | ||
.importPackages(VALID_NAMESPACE)); | ||
} | ||
|
||
@Test | ||
void shouldReturnJavaClassesWithTests() { | ||
JavaClasses result = Namespace.from(VALID_NAMESPACE, Namespace.IMPORT.WITH_TESTS); | ||
|
||
assertNotNull(result); | ||
assertDoesNotThrow(() -> new ClassFileImporter() | ||
.withImportOption(new ImportOption.DoNotIncludeJars()) | ||
.importPackages(VALID_NAMESPACE)); | ||
} | ||
|
||
@Test | ||
void shouldReturnJavaClassesOnlyTests() { | ||
JavaClasses result = Namespace.from(VALID_NAMESPACE, Namespace.IMPORT.ONLY_TESTS); | ||
|
||
assertNotNull(result); | ||
assertDoesNotThrow(() -> new ClassFileImporter() | ||
.withImportOption(new ImportOption.OnlyIncludeTests()) | ||
.withImportOption(new ImportOption.DoNotIncludeJars()) | ||
.importPackages(VALID_NAMESPACE)); | ||
} | ||
|
||
@Test | ||
void shouldThrowExceptionForNullNamespace() { | ||
assertThrows(NullPointerException.class, | ||
() -> Namespace.from(null, Namespace.IMPORT.WITHOUT_TESTS)); | ||
} | ||
|
||
@Test | ||
void shouldThrowExceptionForNullImportOption() { | ||
assertThrows(NullPointerException.class, () -> Namespace.from(VALID_NAMESPACE, null)); | ||
} | ||
} |