use of org.revapi.Difference in project revapi by revapi.
the class ClassificationTransformTest method test.
@Test
public void test() throws Exception {
DummyElement oldE = new DummyElement("old");
DummyElement newE = new DummyElement("new");
Difference difference = Difference.builder().withCode("code").addClassification(CompatibilityType.BINARY, DifferenceSeverity.NON_BREAKING).addClassification(CompatibilityType.SOURCE, DifferenceSeverity.POTENTIALLY_BREAKING).build();
AnalysisContext config = getAnalysisContextFromFullConfig(ClassificationTransform.class, "[{\"extension\": \"revapi.reclassify\", \"configuration\":[{\"code\":\"code\", \"classify\": {\"BINARY\" : \"BREAKING\"}}]}]");
try (ClassificationTransform t = new ClassificationTransform()) {
t.initialize(config);
difference = t.transform(oldE, newE, difference);
assert difference != null && difference.classification.get(CompatibilityType.BINARY) == DifferenceSeverity.BREAKING;
assert difference != null && difference.classification.get(CompatibilityType.SOURCE) == DifferenceSeverity.POTENTIALLY_BREAKING;
}
}
use of org.revapi.Difference in project revapi by revapi.
the class IgnoreDifferenceTransformTest method testRegexMatch.
@Test
public void testRegexMatch() throws Exception {
DummyElement oldE = new DummyElement("a");
DummyElement newE = new DummyElement("b");
Difference difference = Difference.builder().withCode("c").build();
try (IgnoreDifferenceTransform t = new IgnoreDifferenceTransform()) {
AnalysisContext config = getAnalysisContextFromFullConfig(IgnoreDifferenceTransform.class, "[{\"extension\": \"revapi.ignore\", \"configuration\": [{\"regex\": true, \"code\":\"c\", \"justification\" : \"because\"}]}]");
t.initialize(config);
difference = t.transform(oldE, newE, difference);
Assert.assertNull(difference);
}
}
Aggregations