use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.
the class Answer method append.
public void append(Answer answer) {
if (answer._question != null) {
_question = answer._question;
}
_answerElements.addAll(answer._answerElements);
_status = answer._status;
_summary.combine(answer.getSummary());
for (AnswerElement answerElement : answer._answerElements) {
if (answerElement instanceof BatfishStackTrace) {
BatfishException e = ((BatfishStackTrace) answerElement).getException();
throw new QuestionException("Exception answering question", e, this);
}
}
}
use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.
the class ConvertConfigurationAnswerElementTest method testSetErrors.
@Test
public void testSetErrors() {
BatfishException exception = new BatfishException("sample exception");
BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
SortedMap<String, BatfishStackTrace> errors = new TreeMap<>();
errors.put("error", stackTrace);
_element.setErrors(errors);
assertThat(_element.getErrors().get("error"), is(stackTrace));
}
use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.
the class ConvertConfigurationAnswerElementTest method testPrettyPrint.
@Test
public void testPrettyPrint() {
BatfishException exception = new BatfishException("sample exception");
BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
_element.getErrors().put("sampleError", stackTrace);
StringBuilder expected = new StringBuilder();
expected.append("Results from converting vendor configurations\n");
expected.append("\n sampleError[Conversion errors]\n");
for (String line : _element.getErrors().get("sampleError").getLineMap()) {
expected.append(" " + line + "\n");
}
assertThat(_element.prettyPrint(), equalTo(expected.toString()));
}
use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.
the class ConvertConfigurationAnswerElementTest method testGetErrors.
@Test
public void testGetErrors() {
BatfishException exception = new BatfishException("sample exception");
BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
_element.getErrors().put("error", stackTrace);
assertThat(_element.getErrors().get("error"), is(stackTrace));
}
use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.
the class ConvertConfigurationAnswerElementTest method checkNonEmptyErrors.
@Test
public void checkNonEmptyErrors() {
BatfishException exception = new BatfishException("sample exception");
_element.getErrors().put("error", new BatfishStackTrace(exception));
assertThat(_element.getErrors().size(), is(1));
}
Aggregations