diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2016-08-12 22:27:26 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2016-08-12 22:27:26 +0200 |
commit | 78e369043f95e78b27c265f7eab4d766e54054f4 (patch) | |
tree | 4298ac164cb09c4ce6bfe12f4d1a59b7ccb2ca32 /test | |
parent | 0db469d9ae90ad5b72eb0c93952e9ecc68a6d4e7 (diff) |
Refactored a lot of things, started adding the rest of the filtering
Diffstat (limited to 'test')
-rw-r--r-- | test/eu/equalparts/cardbase/filtering/CardFilteringTest.java | 30 | ||||
-rw-r--r-- | test/eu/equalparts/cardbase/sorting/CardSortingTest.java | 20 |
2 files changed, 25 insertions, 25 deletions
diff --git a/test/eu/equalparts/cardbase/filtering/CardFilteringTest.java b/test/eu/equalparts/cardbase/filtering/CardFilteringTest.java index 017e858..8e9d00b 100644 --- a/test/eu/equalparts/cardbase/filtering/CardFilteringTest.java +++ b/test/eu/equalparts/cardbase/filtering/CardFilteringTest.java @@ -74,6 +74,28 @@ public class CardFilteringTest { i++; } } + + @Test + public void filterByNameGreaterThan() throws Exception { + CardFiltering.filterByField(testCards, "name", Filter.GREATER_THAN, "5"); + + assertEquals("Wrong list size.", 8, testCards.size()); + int i = 0; + String[] names = { + "Callow Jushi", + "Coerced Confession", + "Khalni Hydra", + "Nightmare", + "Shivan Dragon", + "Disrupting Shoal", + "Sorin Markov", + "Ugin's Construct", + }; + for (Card card : testCards) { + assertTrue(card.name.get() + " should have been " + names[i] + ", i = " + i, card.name.get().equals(names[i])); + i++; + } + } @Test public void filterByLayoutEquals() throws Exception { @@ -156,7 +178,10 @@ public class CardFilteringTest { @Test public void filterByCMCContains() throws Exception { + CardFiltering.filterByField(testCards, "cmc", Filter.CONTAINS, "5"); + assertEquals("Wrong list size.", 1, testCards.size()); + assertEquals("Coerced Confession", testCards.get(0).name.get()); } @Test @@ -228,9 +253,4 @@ public class CardFilteringTest { public void filterBySetCode() throws Exception { } - - @Test - public void filterByImageCode() throws Exception { - - } } diff --git a/test/eu/equalparts/cardbase/sorting/CardSortingTest.java b/test/eu/equalparts/cardbase/sorting/CardSortingTest.java index 04cf20d..2e4f0e6 100644 --- a/test/eu/equalparts/cardbase/sorting/CardSortingTest.java +++ b/test/eu/equalparts/cardbase/sorting/CardSortingTest.java @@ -350,26 +350,6 @@ public class CardSortingTest { } } - @Test - public void sortByImageCode() throws Exception { - CardSorting.sortByField(testCards, "imageCode"); - int i = 0; - String[] codes = { - "bok", - "bok", - "frf", - "gtc", - "m12", - "m15", - "m15", - "roe", - }; - for (Card card : testCards) { - assertTrue(card.imageCode.get() + " should have been " + codes[i] + ", i = " + i, card.imageCode.get().equals(codes[i])); - i++; - } - } - /* * Edge cases */ |