use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_singleBooleanEntry_assertTrue.
public void testEvaluate_singleBooleanEntry_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_logicalAndOneTrue_assertFalse.
public void testEvaluate_logicalAndOneTrue_assertFalse() throws Exception {
Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_finalNonBoolEntry_assertException.
public void testEvaluate_finalNonBoolEntry_assertException() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
boolean exceptionOccured = false;
final StackMachine stMachine = new StackMachine();
try {
stMachine.evaluate(stuffToProcess);
} catch (IllegalStateException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_equalsDifferentStringValues_assertFalse.
public void testEvaluate_equalsDifferentStringValues_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("22345")));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_notEqualsDifferentTypeValues_assertFalse.
public void testEvaluate_notEqualsDifferentTypeValues_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(12345)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.NOT_EQUALS));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
Aggregations