use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.
the class ClientTest method testValidSubRangeIntegerValue.
@Test
public void testValidSubRangeIntegerValue() throws IOException {
JsonNode subRangeNode = _mapper.readTree("10");
Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
variable.setType(SUBRANGE);
Client.validateType(subRangeNode, variable);
}
use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.
the class ClientTest method testUnsatisfiedMinLengthValue.
@Test
public void testUnsatisfiedMinLengthValue() throws IOException {
String shortString = "\"short\"";
Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
variable.setMinLength(8);
_thrown.expect(BatfishException.class);
_thrown.expectMessage(equalTo("Must be at least 8 characters in length"));
Client.validateType(_mapper.readTree(shortString), variable);
}
use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.
the class ClientTest method validateTypeWithInvalidInput.
private void validateTypeWithInvalidInput(String input, Class<? extends Throwable> expectedException, String expectedMessage, Type type) throws IOException {
JsonNode node = _mapper.readTree(input);
Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
variable.setType(type);
_thrown.expect(expectedException);
_thrown.expectMessage(equalTo(expectedMessage));
Client.validateType(node, variable);
}
use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.
the class ClientTest method testValidJsonPathValue.
@Test
public void testValidJsonPathValue() throws IOException {
JsonNode jsonPathNode = _mapper.readTree("{\"path\" : \"I am path.\", \"suffix\" : true}");
Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
variable.setType(JSON_PATH);
Client.validateType(jsonPathNode, variable);
}
use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.
the class ClientTest method testValidJavaRegexValue.
@Test
public void testValidJavaRegexValue() throws IOException {
JsonNode inputNode = _mapper.readTree("\".*\"");
Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
variable.setType(JAVA_REGEX);
Client.validateType(inputNode, variable);
}
Aggregations