@Test
public void defaultDisabledTrumpsAllOtherSettings() {
settings.setDefaultAction( InstallerAction.DISABLED );
InstallerActionResolver priorityResolver = mock( InstallerActionResolver.class );
settings.setPriorityActionResolver( priorityResolver );
// Set actions for groups
settings.setActionForInstallerGroups( InstallerAction.EXECUTE, "executeOne", "executeTwo" );
settings.setActionForInstallerGroups( InstallerAction.SKIP, "skipOne", "skipTwo" );
settings.setActionForInstallerGroups( InstallerAction.FORCE, "force" );
settings.setActionForInstallerGroups( InstallerAction.REGISTER, Arrays.asList( "registerOne",
"registerTwo" ) );
settings.setActionForInstallerGroups( InstallerAction.DISABLED, "disabled" );
// Set action for specific installer
settings.setActionForInstallers( InstallerAction.FORCE, "java.lang.String" );
// Fetch actions for known installers
Object groupRule = new Object();
String installerRule = "installerRule";
// In these cases the priority resolver should decide
when( priorityResolver.resolve( "skipOne", groupRule ) ).thenReturn( InstallerAction.REGISTER );
when( priorityResolver.resolve( "registerOne", groupRule ) ).thenReturn( InstallerAction.SKIP );
when( priorityResolver.resolve( "disabled", installerRule ) ).thenReturn( InstallerAction.EXECUTE );
// No matter it should always return DISABLED
assertEquals( InstallerAction.DISABLED, settings.shouldRun( "skipOne", groupRule ) );
assertEquals( InstallerAction.DISABLED, settings.shouldRun( "registerOne", groupRule ) );
assertEquals( InstallerAction.DISABLED, settings.shouldRun( "disabled", installerRule ) );