Search in sources :

Example 6 with ModifierFactory

use of pcgen.rules.persistence.token.ModifierFactory in project pcgen by PCGen.

the class SetBooleanModifierTest method testInvalidConstruction.

@Test
public void testInvalidConstruction() {
    try {
        ModifierFactory m = new SetModifierFactory();
        m.getModifier(100, null, new ManagerFactory() {
        }, null, null, null);
        fail("Expected SetModifier with null set value to fail");
    } catch (IllegalArgumentException | NullPointerException e) {
    //Yep!
    }
}
Also used : ManagerFactory(pcgen.base.formula.base.ManagerFactory) ModifierFactory(pcgen.rules.persistence.token.ModifierFactory) Test(org.junit.Test)

Example 7 with ModifierFactory

use of pcgen.rules.persistence.token.ModifierFactory in project pcgen by PCGen.

the class AddNumberModifierTest method testInvalidConstruction.

@Test
public void testInvalidConstruction() {
    try {
        ModifierFactory m = new AddModifierFactory();
        m.getModifier(100, null, new ManagerFactory() {
        }, null, null, null);
        fail("Expected AddModifier with null adder to fail");
    } catch (IllegalArgumentException | NullPointerException e) {
    //Yep!
    }
}
Also used : ManagerFactory(pcgen.base.formula.base.ManagerFactory) ModifierFactory(pcgen.rules.persistence.token.ModifierFactory) Test(org.junit.Test)

Example 8 with ModifierFactory

use of pcgen.rules.persistence.token.ModifierFactory in project pcgen by PCGen.

the class SetBooleanModifierTest method testGetModifier.

@Test
public void testGetModifier() {
    ModifierFactory factory = new SetModifierFactory();
    Modifier<Boolean> modifier = factory.getModifier(5, "True", new ManagerFactory() {
    }, null, varScope, booleanManager);
    assertEquals(5L << 32, modifier.getPriority());
    assertSame(Boolean.class, modifier.getVariableFormat());
    assertEquals(Boolean.TRUE, modifier.process(EvalManagerUtilities.getInputEM(Boolean.FALSE)));
}
Also used : ManagerFactory(pcgen.base.formula.base.ManagerFactory) ModifierFactory(pcgen.rules.persistence.token.ModifierFactory) Test(org.junit.Test)

Example 9 with ModifierFactory

use of pcgen.rules.persistence.token.ModifierFactory in project pcgen by PCGen.

the class MinNumberModifierTest method testInvalidConstruction.

@Test
public void testInvalidConstruction() {
    try {
        ModifierFactory m = new MinModifierFactory();
        m.getModifier(100, null, new ManagerFactory() {
        }, null, null, null);
        fail("Expected MaxModifier with null compare value to fail");
    } catch (IllegalArgumentException | NullPointerException e) {
    //Yep!
    }
}
Also used : ManagerFactory(pcgen.base.formula.base.ManagerFactory) ModifierFactory(pcgen.rules.persistence.token.ModifierFactory) Test(org.junit.Test)

Aggregations

ModifierFactory (pcgen.rules.persistence.token.ModifierFactory)9 Test (org.junit.Test)8 ManagerFactory (pcgen.base.formula.base.ManagerFactory)8 PCGenModifier (pcgen.base.calculation.PCGenModifier)3 CalculationModifier (pcgen.base.calculation.CalculationModifier)2 NEPCalculation (pcgen.base.calculation.NEPCalculation)2 ScopeInstance (pcgen.base.formula.base.ScopeInstance)2 VariableID (pcgen.base.formula.base.VariableID)2 ProcessCalculation (pcgen.cdom.content.ProcessCalculation)2 Equipment (pcgen.core.Equipment)2 Before (org.junit.Before)1 FunctionLibrary (pcgen.base.formula.base.FunctionLibrary)1 LegalScope (pcgen.base.formula.base.LegalScope)1 LegalScopeLibrary (pcgen.base.formula.base.LegalScopeLibrary)1 OperatorLibrary (pcgen.base.formula.base.OperatorLibrary)1 VariableLibrary (pcgen.base.formula.base.VariableLibrary)1 ScopeInstanceFactory (pcgen.base.formula.inst.ScopeInstanceFactory)1 SimpleFormulaManager (pcgen.base.formula.inst.SimpleFormulaManager)1 SimpleFunctionLibrary (pcgen.base.formula.inst.SimpleFunctionLibrary)1 SimpleLegalScope (pcgen.base.formula.inst.SimpleLegalScope)1