Search in sources :

Example 6 with BatfishStackTrace

use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.

the class InitInfoAnswerElementTest method testGetErrors.

@Test
public void testGetErrors() {
    BatfishException exception = new BatfishException("sample exception");
    BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
    List<BatfishStackTrace> errors = new ArrayList<>();
    errors.add(stackTrace);
    _element.getErrors().put("error", errors);
    assertThat(_element.getErrors().get("error"), is(errors));
}
Also used : BatfishException(org.batfish.common.BatfishException) ArrayList(java.util.ArrayList) BatfishStackTrace(org.batfish.common.BatfishException.BatfishStackTrace) Test(org.junit.Test)

Example 7 with BatfishStackTrace

use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.

the class InitInfoAnswerElementTest method checkNonEmptyErrorsSet.

@Test
public void checkNonEmptyErrorsSet() {
    BatfishException exception = new BatfishException("sample exception");
    BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
    _element.getErrors().put("error", new ArrayList<>());
    _element.getErrors().get("error").add(stackTrace);
    assertThat(_element.getErrors().get("error").size(), is(1));
    assertTrue(_element.getErrors().get("error").contains(stackTrace));
}
Also used : BatfishException(org.batfish.common.BatfishException) BatfishStackTrace(org.batfish.common.BatfishException.BatfishStackTrace) Test(org.junit.Test)

Example 8 with BatfishStackTrace

use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.

the class InitInfoAnswerElementTest method testSetErrors.

@Test
public void testSetErrors() {
    BatfishException exception = new BatfishException("sample exception");
    BatfishStackTrace stackTrace = new BatfishStackTrace(exception);
    List<BatfishStackTrace> errors = new ArrayList<>();
    errors.add(stackTrace);
    SortedMap<String, List<BatfishStackTrace>> error = new TreeMap<>();
    error.put("error", errors);
    _element.setErrors(error);
    assertThat(_element.getErrors().get("error"), is(errors));
}
Also used : BatfishException(org.batfish.common.BatfishException) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatfishStackTrace(org.batfish.common.BatfishException.BatfishStackTrace) TreeMap(java.util.TreeMap) Test(org.junit.Test)

Example 9 with BatfishStackTrace

use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.

the class ParseVendorConfigurationAnswerElementTest 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));
}
Also used : BatfishException(org.batfish.common.BatfishException) BatfishStackTrace(org.batfish.common.BatfishException.BatfishStackTrace) TreeMap(java.util.TreeMap) Test(org.junit.Test)

Example 10 with BatfishStackTrace

use of org.batfish.common.BatfishException.BatfishStackTrace in project batfish by batfish.

the class ParseVendorConfigurationAnswerElementTest 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));
}
Also used : BatfishException(org.batfish.common.BatfishException) BatfishStackTrace(org.batfish.common.BatfishException.BatfishStackTrace) Test(org.junit.Test)

Aggregations

BatfishStackTrace (org.batfish.common.BatfishException.BatfishStackTrace)15 BatfishException (org.batfish.common.BatfishException)14 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)4 TreeMap (java.util.TreeMap)3 List (java.util.List)2 Warning (org.batfish.common.Warning)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Verify (com.google.common.base.Verify)1 Cache (com.google.common.cache.Cache)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)1 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 ActiveSpan (io.opentracing.ActiveSpan)1