package ua.yandex.shad.autocomplete;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;

import org.mockito.runners.MockitoJUnitRunner;
import ua.yandex.shad.tries.Trie;
import ua.yandex.shad.tries.Tuple;

@RunWith(MockitoJUnitRunner.class)
public class PrefixMatchesTest {
    @Mock
    private Trie trie;

    @InjectMocks
    private PrefixMatches prefixMatches = new PrefixMatches();

    private Tuple first = new Tuple("one", 3);
    private Tuple second = new Tuple("apple", 5);

    @Test
    public void testLoad_noParameters_sizeIsZero() {
        int expectedSize = 0;

        int actualSize = prefixMatches.load();

        assertEquals(expectedSize, actualSize);
    }

    @Test
    public void testLoad_emptyString_sizeIsZero() {
        int expectedSize = 0;
        String strings = "";

        int actualSize = prefixMatches.load(strings);

        assertEquals(expectedSize, actualSize);
    }

    @Test
    public void testLoad_oneWord_wordAdded() {
        String strings = "one";

        prefixMatches.load(strings);
        verify(trie, times(1)).add(Matchers.eq(first));
        verify(trie).add(Matchers.eq(first));
    }

    @Test
    public void testLoad_twoWordsSeparatedWithSpace_addedTwoWords() {
        String strings = "one apple";

        prefixMatches.load(strings);
        verify(trie, times(1)).add(Matchers.eq(first));
        verify(trie, times(1)).add(Matchers.eq(second));
        verify(trie, times(2)).add(any(Tuple.class));
        verify(trie).add(Matchers.eq(first));
        verify(trie).add(Matchers.eq(second));
    }
}
@@ -692,26 +692,28 @@
 ameters_
-sizeIsZero
+nothingAdded
 () %7B%0A   
@@ -721,124 +721,81 @@
     
-int expectedSize = 0;%0A%0A        int actualSize = prefixMatches.load();%0A%0A        assertEquals(expectedSize, actualSize
+prefixMatches.load();%0A%0A        verify(trie, never()).add(any(Tuple.class)
 );%0A 
@@ -851,53 +851,25 @@
 ing_
-sizeIsZero
+nothingAdded
 () %7B%0A
-        int expectedSize = 0;%0A
     
@@ -905,25 +905,8 @@
     
- int actualSize =
  pre
@@ -944,45 +944,50 @@
     
-assertEquals(expectedSize, actualSize
+verify(trie, never()).add(any(Tuple.class)
 );%0A 
@@ -1027,17 +1027,27 @@
 estLoad_
-o
+stringWithO
 neWord_w
@@ -1121,32 +1121,33 @@
 .load(strings);%0A
+%0A
         verify(t
@@ -1274,17 +1274,27 @@
 estLoad_
-t
+stringWithT
 woWordsS
@@ -1405,16 +1405,834 @@
 rings);%0A
+%0A        verify(trie, times(1)).add(Matchers.eq(first));%0A        verify(trie, times(1)).add(Matchers.eq(second));%0A        verify(trie, times(2)).add(any(Tuple.class));%0A        verify(trie).add(Matchers.eq(first));%0A        verify(trie).add(Matchers.eq(second));%0A    %7D%0A%0A    @Test%0A    public void testLoad_stringWithTwoWordsSeparatedWithTab_addedTwoWords() %7B%0A        String strings = %22one   apple%22;%0A%0A        prefixMatches.load(strings);%0A%0A        verify(trie, times(1)).add(Matchers.eq(first));%0A        verify(trie, times(1)).add(Matchers.eq(second));%0A        verify(trie, times(2)).add(any(Tuple.class));%0A        verify(trie).add(Matchers.eq(first));%0A    %7D%0A%0A    @Test%0A    public void testLoad_twoStringsWithOneWordEach_addedTwoWords() %7B%0A        String%5B%5D strings = %7B%22one%22, %22apple%22%7D;%0A%0A        prefixMatches.load(strings);%0A%0A
         

Modify test for PrefixMatches load method. Now there are RED tests.