package edu.chl.proton.model;

import org.junit.Test;

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

import static org.junit.Assert.assertTrue;

/**
 * @author Mickaela
 * Created by Mickaela on 2017-05-14.
 */
public class MarkdownTest {

    private List<String> lines = new ArrayList<>();
    private Markdown markdown;


    @Test public void getHTMLTest() {
        String str = "##The story of an hour\rIt was her sister *Josephine* who told her, " +
                "in broken sentences; veiled **hints** that revealed in half " +
                "concealing.\r Her husband's friend *Richards* was there, too, " +
                "near her.\r > It was he who had been in the newspaper office " +
                "when intelligence of the railroad disaster was received, " +
                "with Brently Mallard's name leading ***the list of killed:***\r" +
                "* Anthony Meier\r" +
                "*Ron Swanson\r" +
                "- Bethany Swanson\r" +
                "-Sarah Clarksson\r" +
                "He had only taken the time to assure himself of its truth by a " +
                "second [telegram](link to stuff), and had ![hastened](dunno) to forestall any less careful," +
                " less tender friend in bearing the sad message.\r";

        String[] original = str.split("\r");

        for(String s : original){
            this.lines.add(s);
        }

        markdown = new Markdown(lines);

        String outcome = "<h2>The story of an hour</h2>\rIt was her sister <i>Josephine</i> who told her, " +
                "in broken sentences; veiled <b>hints</b> that revealed in half " +
                "concealing.\r Her husband's friend <i>Richards</i> was there, too, " +
                "near her.\r > It was he who had been in the newspaper office " +
                "when intelligence of the railroad disaster was received, " +
                "with Brently Mallard's name leading <i><b>the list of killed:</b></i>\r" +
                "<ul><li> Anthony Meier</li>\r" +
                "<li>Ron Swanson</li>\r" +
                "<li> Bethany Swanson</li>\r" +
                "<li>Sarah Clarksson</li></ul>\r" +
                "He had only taken the time to assure himself of its truth by a " +
                "second <a href=\"link to stuff\">telegram</a>, and had <img src=\"dunno\" alt=\"hastened\"> to forestall any less careful," +
                " less tender friend in bearing the sad message.\r";

        String[] withStyling = outcome.split("\r");
        List<String> tmp = new ArrayList<>();

        for(String s : withStyling){
            tmp.add(s);
        }

        assertTrue("Text should get HTML tags: ", markdown.getHTML().equals(tmp));

    }



}

@@ -581,33 +581,32 @@
   %22concealing.%5Cr
- 
 Her husband's fr
@@ -662,33 +662,32 @@
     %22near her.%5Cr
- 
 %3E It was he who 
@@ -892,164 +892,8 @@
  +%0D%0A
-                %22* Anthony Meier%5Cr%22 +%0D%0A                %22*Ron Swanson%5Cr%22 +%0D%0A                %22- Bethany Swanson%5Cr%22 +%0D%0A                %22-Sarah Clarksson%5Cr%22 +%0D%0A
     
@@ -1318,16 +1318,45 @@
 arkdown(
+);%0D%0A        markdown.setText(
 lines);%0D
@@ -1671,17 +1671,28 @@
 r her.%5Cr
- 
+%3Cblockquote%3E
 %3E It was
@@ -1723,32 +1723,47 @@
 newspaper office
+%3C/blockquote%3E%5Cr
  %22 +%0D%0A          
@@ -1928,205 +1928,8 @@
  +%0D%0A
-                %22%3Cul%3E%3Cli%3E Anthony Meier%3C/li%3E%5Cr%22 +%0D%0A                %22%3Cli%3ERon Swanson%3C/li%3E%5Cr%22 +%0D%0A                %22%3Cli%3E Bethany Swanson%3C/li%3E%5Cr%22 +%0D%0A                %22%3Cli%3ESarah Clarksson%3C/li%3E%3C/ul%3E%5Cr%22 +%0D%0A
     

Fix MarkdownTest