From 78e369043f95e78b27c265f7eab4d766e54054f4 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Fri, 12 Aug 2016 22:27:26 +0200 Subject: Refactored a lot of things, started adding the rest of the filtering --- .../cardbase/filtering/CardFilteringTest.java | 30 ++++++++++++++++++---- .../cardbase/sorting/CardSortingTest.java | 20 --------------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'test') 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 */ -- cgit v1.2.3