From dfeabe6d5a13b11c60cafe6353295c37a912ff54 Mon Sep 17 00:00:00 2001 From: Tarekk Mohamed Abdalla Date: Mon, 3 May 2021 14:53:28 +0200 Subject: [PATCH] NF: make TagsListTest more readable --- .../ichi2/anki/dialogs/tags/TagsListTest.java | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/tags/TagsListTest.java b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/tags/TagsListTest.java index e100ca60a27e..a18c1764f188 100644 --- a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/tags/TagsListTest.java +++ b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/tags/TagsListTest.java @@ -135,9 +135,11 @@ public void setUp() throws Exception { @Test public void test_constructor_will_remove_dups() { + List allTags = Arrays.asList("a", "b", "a"); + List checkedTags = Arrays.asList("b", "b", "b"); TagsList list = new TagsList( - Arrays.asList("a", "b", "a"), - Arrays.asList("b", "b", "b") + allTags, + checkedTags ); assertEquals("All tags list should not contain any duplicates", @@ -149,10 +151,13 @@ public void test_constructor_will_remove_dups() { @Test public void test_constructor_will_remove_dups_unchecked() { + List allTags = Arrays.asList("a", "b", "a", "c", "c", "d"); + List checkedTags = Arrays.asList("b", "b", "b"); + List uncheckedTags = Arrays.asList("c", "c", "d"); TagsList list = new TagsList( - Arrays.asList("a", "b", "a", "c", "c", "d"), - Arrays.asList("b", "b", "b"), - Arrays.asList("c", "c", "d") + allTags, + checkedTags, + uncheckedTags ); assertEquals("All tags list should not contain any duplicates", @@ -166,9 +171,11 @@ public void test_constructor_will_remove_dups_unchecked() { @Test public void test_constructor_will_ignore_casing() { + List allTags = Arrays.asList("aA", "bb", "aa"); + List checkedTags = Arrays.asList("bb", "Bb", "bB"); TagsList list = new TagsList( - Arrays.asList("aA", "bb", "aa"), - Arrays.asList("bb", "Bb", "bB") + allTags, + checkedTags ); assertEquals("All tags list should not contain any duplicates (case insensitive)", @@ -179,10 +186,13 @@ public void test_constructor_will_ignore_casing() { @Test public void test_constructor_will_ignore_casing_unchecked() { + List allTags = Arrays.asList("aA", "bb", "aa", "cc", "dd"); + List checkedTags = Arrays.asList("bb", "Bb", "bB", "dd", "ff"); + List uncheckedTags = Arrays.asList("BB", "cC", "cC", "dD", "CC"); TagsList list = new TagsList( - Arrays.asList("aA", "bb", "aa", "cc", "dd"), - Arrays.asList("bb", "Bb", "bB", "dd", "ff"), - Arrays.asList("BB", "cC", "cC", "dD", "CC") + allTags, + checkedTags, + uncheckedTags ); assertEquals("All tags list should not contain any duplicates (case insensitive)", @@ -196,9 +206,11 @@ public void test_constructor_will_ignore_casing_unchecked() { @Test public void test_constructor_will_add_checked_to_all() { + List allTags = Arrays.asList("aA", "bb", "aa"); + List checkedTags = Arrays.asList("bb", "Bb", "bB", "cc"); TagsList list = new TagsList( - Arrays.asList("aA", "bb", "aa"), - Arrays.asList("bb", "Bb", "bB", "cc") + allTags, + checkedTags ); assertEquals("Extra tags in checked not found in all tags, must be added to all tags list", @@ -210,10 +222,13 @@ public void test_constructor_will_add_checked_to_all() { @Test public void test_constructor_will_add_checked_and_unchecked_to_all() { + List allTags = Arrays.asList("aA", "bb", "aa"); + List checkedTags = Arrays.asList("bb", "Bb", "bB", "Cc", "zz"); + List uncheckedTags = Arrays.asList("BB", "cC", "cC", "dD", "CC"); TagsList list = new TagsList( - Arrays.asList("aA", "bb", "aa"), - Arrays.asList("bb", "Bb", "bB", "Cc", "zz"), - Arrays.asList("BB", "cC", "cC", "dD", "CC") + allTags, + checkedTags, + uncheckedTags ); assertEquals("Extra tags in checked not found in all tags, must be added to all tags list",