package com.grayben.riskExtractor.htmlScorer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static junit.framework.TestCase.fail;

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

    @Before
    public void setUp() throws Exception {
        super.setUp();
        setHtmlScorerSUT(new TreeHtmlScorer());
    }

    @After
    public void tearDown() throws Exception {
        setHtmlScorerSUT(null);
    }

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

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

    @Override
    @Test
    public void
    test_ScoreHtmlReturnsExpected_WhenTextInputIsComplicated
            () throws Exception {
        fail("Test not implemented");
    }
}
@@ -51,420 +51,2274 @@
 ort 
-org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport static junit.framework.TestCase.fail;%0A%0A/**%0A * Created by beng on 28/11/2015.%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class TreeHtmlScorerTest%0A        extends HtmlScorerTest %7B%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        super.setUp();
+com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;%0Aimport com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers.MapScorer;%0Aimport com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers.TagEmphasisScorer;%0Aimport org.jsoup.nodes.Element;%0Aimport org.jsoup.parser.Tag;%0Aimport org.jsoup.select.NodeTraversor;%0Aimport org.jsoup.select.NodeVisitor;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Matchers;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.internal.matchers.Any;%0Aimport org.mockito.invocation.InvocationOnMock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0Aimport org.mockito.stubbing.Answer;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport static junit.framework.TestCase.fail;%0A%0A/**%0A * Created by beng on 28/11/2015.%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class TreeHtmlScorerTest%0A        extends HtmlScorerTest %7B%0A%0A    TreeHtmlScorer treeHtmlScorerSUT;%0A%0A    private %3CT extends Object%3E MapScorer%3CT%3E%0A    stubScorerMethods(Class%3CT%3E clazz, MapScorer%3CT%3E scorerMock, Map%3CT, Integer%3E scoreMap)%7B%0A        //TODO: check that the label was defined (I didn't construct the object!)%0A        Mockito.doCallRealMethod().when(scorerMock.getScoreLabel());%0A%0A        Mockito.doAnswer(invocationOnMock -%3E %7B%0A            T argument = (T)(invocationOnMock.getArguments())%5B0%5D;%0A            return scoreMap.get(argument);%0A        %7D).when(scorerMock.score(Mockito.any(clazz)));%0A%0A        return scorerMock;%0A    %7D%0A%0A    private TagEmphasisScorer stubTagEmphasisScorer(Map%3CTag, Integer%3E scoreMap)%7B%0A        TagEmphasisScorer scorer = Mockito.mock(TagEmphasisScorer.class);%0A        scorer = stubScorerMethods(Tag.class, scorer, scoreMap);%0A        return scorer;%0A    %7D%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        Set%3CScorer%3CElement%3E%3E elementScorers = new HashSet%3C%3E();%0A        Map%3CTag, Integer%3E tagEmphasisScores = TagEmphasisScorer.defaultMap();%0A        TagEmphasisScorer tagEmphasisScorer%0A                = new Mockito().mock(TagEmphasisScorer.class);%0A%0A%0A%0A        Mockito.doCallRealMethod().when(tagEmphasisScorer.getScoreLabel());%0A        NodeVisitor nv = new ScoringAndFlatteningNodeVisitor()%0A        NodeTraversor nt = new NodeTraversor()
 %0A   
@@ -2358,24 +2358,47 @@
 lScorer());%0A
+        super.setUp();%0A
     %7D%0A%0A    @

Work on stubbing collaborators