package com.thoughtworks.cozmos;

import junit.framework.TestCase;

public class ExtraneousWordDocConvertorTestCase extends TestCase {

    public void testShouldNotConvertEmptyText() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("");
        assertEquals("", convertor.convert());
    }

    public void testShouldNotConvertPlainText() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("The quick brown fox");
        assertEquals("The quick brown fox", convertor.convert());
    }

    public void testShouldNotConvertUnrecognizedSpans() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("<span class=foo>Cozmos</span>");
        assertEquals("<span class=foo>Cozmos</span>", convertor.convert());
    }

    public void testShouldConvertAllegedSpellingMistakes() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("<span class=SpellE>Cozmos</span>");
        assertEquals("Cozmos", convertor.convert());
    }

    public void testShouldConvertAllegedGrammarMistakes() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("<span class=GramE>hello</span>");
        assertEquals("hello", convertor.convert());
    }

    public void testShouldConvertMultipleSpellingMistakes() throws Exception {
        ExtraneousWordDocConvertor convertor = convertor("<span class=SpellE>A</span><span class=SpellE>B</span>");
        assertEquals("AB", convertor.convert());
    }



    private static ExtraneousWordDocConvertor convertor(String pageText) {
        return new ExtraneousWordDocConvertor(pageText);
    }
}

@@ -1493,17 +1493,301 @@
 %0A    %7D%0A%0A
-%0A
+    public void testShouldConvertBothSpellingAndGrammarMistakes() throws Exception %7B%0A        ExtraneousWordDocConvertor convertor = convertor(%22%3Cspan class=SpellE%3ETeh%3C/span%3E %3Cspan class=GramE%3Ebrown quick%3C/span%3E%22);%0A        assertEquals(%22Teh brown quick%22, convertor.convert());%0A    %7D%0A    
 %0A    pri

Allow to mix-and-match spelling errors and grammar errors