01: package net.sf.clirr.ant;
02:
03: import junit.framework.TestCase;
04: import net.sf.clirr.core.ApiDifference;
05: import net.sf.clirr.core.Severity;
06: import net.sf.clirr.core.Message;
07:
08: public class ChangeCounterTest extends TestCase {
09: public void testCorrectCounting() {
10: // a dummy message object
11: Message msg = new Message(0, false);
12:
13: ChangeCounter counter = new ChangeCounter();
14: counter.reportDiff(new ApiDifference(msg, Severity.WARNING,
15: "Test", null, null, null));
16: counter.reportDiff(new ApiDifference(msg, Severity.ERROR,
17: "Test", null, null, null));
18: counter.reportDiff(new ApiDifference(msg, Severity.INFO,
19: "Test", null, null, null));
20: counter.reportDiff(new ApiDifference(msg, Severity.ERROR,
21: "Test", null, null, null));
22: counter.reportDiff(new ApiDifference(msg, Severity.ERROR,
23: "Test", null, null, null));
24: counter.reportDiff(new ApiDifference(msg, Severity.WARNING,
25: "Test", null, null, null));
26: assertEquals("number of expected errors", 3, counter
27: .getBinErrors());
28: assertEquals("number of expected warnings", 2, counter
29: .getBinWarnings());
30: assertEquals("number of expected infos", 1, counter
31: .getBinInfos());
32: }
33: }
|