use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testIsRearmExceededBogusType.
@Test
public void testIsRearmExceededBogusType() {
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.RELATIVE_CHANGE);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(99.0);
threshold.setRearm(0.5);
threshold.setTrigger(1);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("This thresholding strategy can only be used for thresholding types of 'high' and 'low'."));
try {
ThresholdEvaluatorStateHighLow item = new ThresholdEvaluatorStateHighLow(wrapper);
item.isThresholdExceeded(0.0);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoValue.
@Test
public void testConstructorThresholdNoValue() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'value' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoDsName.
@Test
public void testConstructorThresholdNoDsName() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'ds-name' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsType("node");
threshold.setValue(1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoType.
@Test
public void testConstructorThresholdNoType() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'type' value set"));
Threshold threshold = new Threshold();
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNull.
@Test
public void testConstructorThresholdNull() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold argument cannot be null"));
try {
new ThresholdEvaluatorStateHighLow(null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations