-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
115 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 23 additions & 13 deletions
36
src/test/java/io/split/android/client/FilterGrouperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,40 @@ | ||
package io.split.android.client; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class FilterGrouperTest { | ||
|
||
FilterGrouper mFilterGrouper = new FilterGrouper(); | ||
|
||
@Test | ||
public void groupingFilters() { | ||
List<SplitFilter> ungropedFilters = new ArrayList<>(); | ||
ungropedFilters.add(SplitFilter.byName(Arrays.asList("f1", "f2", "f3"))); | ||
ungropedFilters.add(SplitFilter.byName(Arrays.asList("f2", "f3", "f4"))); | ||
ungropedFilters.add(SplitFilter.byName(Arrays.asList("f4", "f5", "f6"))); | ||
ungropedFilters.add(SplitFilter.byPrefix(Arrays.asList("f1", "f2", "f3"))); | ||
ungropedFilters.add(SplitFilter.byPrefix(Arrays.asList("f2", "f3", "f4"))); | ||
ungropedFilters.add(SplitFilter.byPrefix(Arrays.asList("f4", "f5", "f6"))); | ||
|
||
List<SplitFilter> groupedFiltes = mFilterGrouper.group(ungropedFilters); | ||
|
||
/// This compoe | ||
Assert.assertEquals(2, groupedFiltes.size()); | ||
List<SplitFilter> ungroupedFilters = new ArrayList<>(); | ||
ungroupedFilters.add(SplitFilter.byName(Arrays.asList("f1", "f2", "f3"))); | ||
ungroupedFilters.add(SplitFilter.byName(Arrays.asList("f2", "f3", "f4"))); | ||
ungroupedFilters.add(SplitFilter.byName(Arrays.asList("f4", "f5", "f6"))); | ||
ungroupedFilters.add(SplitFilter.byPrefix(Arrays.asList("f1", "f2", "f3"))); | ||
ungroupedFilters.add(SplitFilter.byPrefix(Arrays.asList("f2", "f3", "f4"))); | ||
ungroupedFilters.add(SplitFilter.byPrefix(Arrays.asList("f4", "f5", "f6"))); | ||
ungroupedFilters.add(SplitFilter.bySet(Arrays.asList("f1", "f2", "f3"))); | ||
ungroupedFilters.add(SplitFilter.bySet(Arrays.asList("f2", "f3", "f4"))); | ||
ungroupedFilters.add(SplitFilter.bySet(Arrays.asList("f4", "f5", "f6"))); | ||
|
||
Map<SplitFilter.Type, SplitFilter> groupedFilters = mFilterGrouper.group(ungroupedFilters); | ||
|
||
// this class only merges filters of the same type | ||
assertEquals(3, groupedFilters.size()); | ||
assertTrue(groupedFilters.containsKey(SplitFilter.Type.BY_NAME)); | ||
assertTrue(groupedFilters.containsKey(SplitFilter.Type.BY_PREFIX)); | ||
assertTrue(groupedFilters.containsKey(SplitFilter.Type.BY_SET)); | ||
} | ||
|
||
} |
Oops, something went wrong.