package com.grayben.riskExtractor.htmlScorer.partScorers.elementScorers;

import com.grayben.riskExtractor.htmlScorer.partScorers.ScorerTest;
import com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers.TagEmphasisScorer;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static com.grayben.riskExtractor.htmlScorer.partScorers.TestHelper.*;
import static junit.framework.Assert.assertEquals;
import static junit.framework.TestCase.fail;

/**
 * Created by beng on 28/11/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class SegmentationElementScorerTest
        extends ScorerTest<Element> {

    SegmentationElementScorer elementScorerSUT;

    public Element elementToBeScoredMock;

    @Before
    public void setUp() throws Exception {
        TagEmphasisScorer tagScorer
                = new TagEmphasisScorer(TagEmphasisScorer.defaultMap());
        elementScorerSUT = new SegmentationElementScorer(tagScorer);
        super.setScorerSUT(elementScorerSUT);
        super.setArgumentToBeScoredMock(elementToBeScoredMock);
        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        elementScorerSUT = null;
        super.tearDown();
    }

    @Override
    @Test
    public void
    test_ScoreReturnsInteger_WhenArgumentIsNotEmpty() throws Exception {
        Tag tagStub = stubTag("a-tag-name");
        Attributes attributeStubs = dummyAttributes();
        elementToBeScoredMock = stubElement(tagStub, attributeStubs);
        
        Integer returned = elementScorerSUT.score(elementToBeScoredMock);

        assertEquals(Integer.class, returned.getClass());
    }

    @Override
    @Test
    public void
    test_ScoreGivesExpectedResult_WhenSimpleInput() throws Exception {
        fail("Test not implemented");
    }

    @Test
    public void
    test_ScoreThrowsIllegalArgumentException_WhenEmptyInput() throws Exception {
        fail("Test not implemented: decide whether appropriate");
    }

}
@@ -422,16 +422,44 @@
 unWith;%0A
+import org.mockito.Mockito;%0A
 import o
@@ -497,16 +497,16 @@
 Runner;%0A
-
 %0Aimport 
@@ -1706,17 +1706,9 @@
 s);%0A
-        
 %0A
+
     
@@ -2049,132 +2049,1014 @@
 rows
-IllegalArgumentException_WhenEmptyInput() throws Exception %7B%0A        fail(%22Test not implemented: decide whether appropriate%22
+NullPointerException_WhenTagIsNull() throws Exception %7B%0A        thrown.expect(NullPointerException.class);%0A%0A        Attributes attributes = dummyAttributes();%0A%0A        elementToBeScoredMock = stubElement(null, attributes);%0A%0A        elementScorerSUT.score(elementToBeScoredMock);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ScoreThrowsNullPointerException_WhenAttributesIsNull() throws Exception %7B%0A        thrown.expect(NullPointerException.class);%0A%0A        elementToBeScoredMock = stubElement(stubTag(%22font%22), null);%0A%0A        elementScorerSUT.score(elementToBeScoredMock);%0A    %7D%0A%0A    @Test%0A    public void%0A    test_ScoreThrowsIllegalArgumentException_WhenTagIsEmpty() throws Exception %7B%0A        Tag tagStub = stubTag(%22%22);%0A        Mockito.when(tagStub.isEmpty()).thenReturn(true);%0A%0A        Attributes attributes = dummyAttributes();%0A%0A        elementToBeScoredMock = stubElement(tagStub, attributes);%0A%0A        thrown.expect(IllegalArgumentException.class);%0A%0A        elementScorerSUT.score(elementToBeScoredMock
 );%0A 

Implement tests