-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6065 from bstansberry/WFCORE-6889
[WFCORE-6889] Add a ModuleDependency.Builder class
- Loading branch information
Showing
2 changed files
with
155 additions
and
4 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
54 changes: 54 additions & 0 deletions
54
server/src/test/java/org/jboss/as/server/deployment/module/ModuleDependencyUnitTestCase.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,54 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.as.server.deployment.module; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.jboss.modules.ModuleLoader; | ||
import org.junit.Test; | ||
|
||
public class ModuleDependencyUnitTestCase { | ||
|
||
private static final String MODULE_NAME = "foo"; | ||
private static final ModuleLoader TEST_LOADER = new ModuleLoader(ModuleLoader.NO_FINDERS); | ||
|
||
@Test | ||
public void testBasicBuilder() { | ||
ModuleDependency dep = ModuleDependency.Builder.of(TEST_LOADER, MODULE_NAME).build(); | ||
assertEquals(TEST_LOADER, dep.getModuleLoader()); | ||
assertEquals(MODULE_NAME, dep.getIdentifier().getName()); | ||
assertFalse(dep.isExport()); | ||
assertFalse(dep.isImportServices()); | ||
assertFalse(dep.isOptional()); | ||
assertFalse(dep.isUserSpecified()); | ||
assertNotNull(dep.getReason()); | ||
assertTrue(dep.getReason().isEmpty()); | ||
} | ||
|
||
@Test | ||
public void testSpecifiedBuilder() { | ||
|
||
ModuleDependency dep = ModuleDependency.Builder.of(TEST_LOADER, MODULE_NAME) | ||
.setExport(true) | ||
.setImportServices(true) | ||
.setOptional(true) | ||
.setUserSpecified(true) | ||
.setReason(MODULE_NAME) | ||
.build(); | ||
|
||
assertEquals(TEST_LOADER, dep.getModuleLoader()); | ||
assertEquals(MODULE_NAME, dep.getIdentifier().getName()); | ||
assertTrue(dep.isExport()); | ||
assertTrue(dep.isImportServices()); | ||
assertTrue(dep.isOptional()); | ||
assertTrue(dep.isUserSpecified()); | ||
assertFalse(dep.getReason().isEmpty()); | ||
assertEquals(MODULE_NAME, dep.getReason().get()); | ||
} | ||
} |