package com.grayben.riskExtractor.headingMarker;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by beng on 2/12/2015.
 */
public class UnmodifiableTextTest {

    protected UnmodifiableText unmodifiableTextSUT = null;

    protected List<String> stringListArgument = null;

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

    @Before
    public void setUp() throws Exception {
        stringListArgument = new ArrayList<>();
        stringListArgument.add("one");
        stringListArgument.add("two");
        stringListArgument.add("cow");
        unmodifiableTextSUT = new UnmodifiableText(stringListArgument);
    }

    @After
    public void tearDown() throws Exception {
        unmodifiableTextSUT = null;
        stringListArgument = null;
    }

    @Test
    public void
    test_ReturnedStringListEqualsStringList
            () throws Exception {
        List<String> returnedStringList = unmodifiableTextSUT.getStringList();
        assert(returnedStringList.equals(stringListArgument));
    }

    @Test
    public void
    test_ReturnedStringListThrowsUnsupportedOperationException_WhenModified
            () throws Exception {
        List<String> returnedStringList = unmodifiableTextSUT.getStringList();

        thrown.expect(UnsupportedOperationException.class);

        returnedStringList.add("something");
    }
}
@@ -513,24 +513,30 @@
 @Before%0A    
+final 
 public void 
@@ -817,24 +817,30 @@
  @After%0A    
+final 
 public void 
@@ -939,32 +939,578 @@
  = null;%0A    %7D%0A%0A
+    @Test%0A    public void%0A    test_ConstructingThrowsNullPointerException_WhenStringListIsNull%0A            () throws Exception %7B%0A        thrown.expect(NullPointerException.class);%0A%0A        stringListArgument = null;%0A%0A        new UnmodifiableText(stringListArgument);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ConstructingThrowsNullPointerException_WhenPrototypeIsNull%0A            () throws Exception %7B%0A        thrown.expect(NullPointerException.class);%0A%0A        UnmodifiableText prototype = null;%0A%0A        new UnmodifiableText(prototype);%0A    %7D%0A%0A
     @Test%0A    pu

Write tests