Commits

Samael Bate  committed bf9e76d

removing duplicated unit tests

  • Participants
  • Parent commits f32ab42

Comments (0)

Files changed (1)

File src/test/java/com/samandrob/confluence/WTFilter/TestWTFilterPlugin.java

-package com.samandrob.confluence.WTFilter;
-
-import com.samandrob.confluence.WTFilter.mocks.MockBandanaManager;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-
-
-public class TestWTFilterPlugin {
-    private ProfanityManagerImpl profanityManager;
-
-    MockBandanaManager mockBandanaManager;
-
-    @Before
-    public void setup() {
-        mockBandanaManager = new MockBandanaManager();
-        profanityManager = new ProfanityManagerImpl();
-
-        profanityManager.setBandanaManager(mockBandanaManager);
-    }
-
-    @After
-    public void tearDown() {
-        
-    }
-
-    @Test
-    public void testWordCanBeAddedAndRetrieved() {
-        String profanity = "badword";
-
-        profanityManager.addWord(profanity);
-
-        List<String> badwords = profanityManager.getWords();
-
-        assertEquals(1, badwords.size());
-        assertEquals(profanity, badwords.get(0));
-    }
-
-    @Test
-    public void testBadWordInOkWord() {
-        String post = "Badminton is a great sport, unless you're bad at it.";
-        String profanity = "Bad";
-
-        profanityManager.addWord(profanity);
-
-        String result = profanityManager.replaceCensoredWords(post, "####");
-        assertEquals("Badminton is a great sport, unless you're #### at it.", result);
-    }
-
-    @Test
-    public void testCensoringMultipleWords() {
-        String post = "Cats are ok, but bears aren't.  People breed cats and dogs but they don't breed wolves.  Tigers are not sheep.";
-
-        String[] profanities = {"dogs","cats","sheep", "wolves", "tigers", "bears"};
-
-        for (String profanity : profanities)
-            profanityManager.addWord(profanity);
-
-        String result = profanityManager.replaceCensoredWords(post, "---");
-        assertEquals("--- are ok, but --- aren't.  People breed --- and --- but they don't breed ---.  --- are not ---.", result);
-    }
-
-    @Test
-    public void testCensoringOnMultipleLines() {
-        String post = "One line\r\nLine two\r\nNow it's three.\r\nfour";
-        String[] profanities = {"one","two","three", "four"};
-
-        for (String profanity : profanities)
-            profanityManager.addWord(profanity);
-
-        String result = profanityManager.replaceCensoredWords(post, "---");
-        assertEquals("--- line\r\nLine ---\r\nNow it's ---.\r\n---", result);
-    }
-    @Test
-    public void testCannotAddDuplicateWords() {
-        String profanity = "penguins";
-
-        profanityManager.addWord(profanity);
-        profanityManager.addWord(profanity);
-
-        assertEquals(1, profanityManager.getWords().size());
-    }
-
-    @Test
-    public void testRemoveSingleWordFromSet() {
-        String[] profanities = {"dogs","cats","sheep", "wolves", "tigers", "bears"};
-
-        for (String profanity : profanities)
-            profanityManager.addWord(profanity);
-
-        assertEquals(6, profanityManager.getWords().size());
-        profanityManager.removeWord("sheep");
-        assertEquals(5, profanityManager.getWords().size());
-    }
-
-    @Test
-    public void testClearAllWords() {
-        String[] profanities = {"dogs","cats","sheep", "wolves", "tigers", "bears"};
-
-        for (String profanity : profanities)
-            profanityManager.addWord(profanity);
-
-        assertEquals(6, profanityManager.getWords().size());
-        profanityManager.clearWords();
-        assertEquals(0, profanityManager.getWords().size());
-    }
-}