01: package liquibase.parser.filter;
02:
03: import liquibase.ChangeSet;
04: import static org.junit.Assert.*;
05: import org.junit.Test;
06:
07: public class CountChangeSetFilterTest {
08:
09: @Test
10: public void acceptsZeroCorrectly() {
11: CountChangeSetFilter filter = new CountChangeSetFilter(0);
12: assertFalse(filter.accepts(new ChangeSet("a1", "b1", false,
13: false, "c1", null, null, null)));
14: assertFalse(filter.accepts(new ChangeSet("a2", "b2", false,
15: false, "c2", null, null, null)));
16: }
17:
18: @Test
19: public void acceptsOneCorrectly() {
20: CountChangeSetFilter filter = new CountChangeSetFilter(1);
21: assertTrue(filter.accepts(new ChangeSet("a1", "b1", false,
22: false, "c1", null, null, null)));
23: assertFalse(filter.accepts(new ChangeSet("a2", "b2", false,
24: false, "c2", null, null, null)));
25: }
26:
27: @Test
28: public void acceptsTwoCorrectly() {
29: CountChangeSetFilter filter = new CountChangeSetFilter(2);
30: assertTrue(filter.accepts(new ChangeSet("a1", "b1", false,
31: false, "c1", null, null, null)));
32: assertTrue(filter.accepts(new ChangeSet("a2", "b2", false,
33: false, "c2", null, null, null)));
34: assertFalse(filter.accepts(new ChangeSet("a3", "b3", false,
35: false, "c3", null, null, null)));
36: }
37: }
|