package com.grayben.riskExtractor.headingMarker;

import org.junit.*;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.List;

import static org.junit.Assert.*;

/**
 * Created by beng on 28/11/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class TextCandidateTest {

    TextCandidate textCandidateSUT;

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    int index = 0;

    @Mock
    List<String> list;
    int listSize = 50;

    @Before
    public void setUp() throws Exception {
        Mockito.when(list.size()).thenReturn(listSize);
        textCandidateSUT = new TextCandidate(list, index);
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void
    test_ConstructorThrowsIndexOutOfBoundsException_WhenIndexIsNegative(){
        index = -1;

        thrown.expect(IndexOutOfBoundsException.class);

        textCandidateSUT = new TextCandidate(list, index);
    }

    @Test
    public void
    test_ConstructorThrowsIndexOutOfBoundsException_WhenIndexIsTooHigh
            () throws Exception {
        Mockito.when(list.size()).thenReturn(listSize);
        index = listSize + 1;

        thrown.expect(IndexOutOfBoundsException.class);

        textCandidateSUT = new TextCandidate(list, index);
    }

    @Test
    public void
    test_ConstructorThrowsNullPointerException_WhenListIsNull
            () throws Exception {

        thrown.expect(NullPointerException.class);

        textCandidateSUT = new TextCandidate(null, index);
    }
}
@@ -446,16 +446,54 @@
 teSUT;%0A%0A
+    List%3CString%3E stringListReturned;%0A%0A
     @Rul
@@ -494,16 +494,16 @@
   @Rule%0A
-
     publ
@@ -798,32 +798,89 @@
 e(list, index);%0A
+        stringListReturned = textCandidateSUT.getList();%0A
     %7D%0A%0A    @Afte
@@ -1688,32 +1688,32 @@
 eption.class);%0A%0A
-
         textCand
@@ -1760,10 +1760,1968 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenAddObject%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenAddObjectWithIndex%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenAddAllCollection%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenAddAllCollectionWithIndex%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenClear%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenRemoveAll%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenReplaceAll%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenRetainAll%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenSet%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ReturnedTextListThrowsUnsupportedOperationException_WhenSort%0A            () throws Exception %7B%0A        fail(%22This test has not been implemented%22);%0A    %7D
 %0A%7D

Add tests for immutability of TextCandidates.textList