package com.sleekbyte.tailor.functional;

import com.sleekbyte.tailor.common.Messages;
import com.sleekbyte.tailor.output.Printer;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

/**
 * Functional tests for sorted printer output
 */
@RunWith(MockitoJUnitRunner.class)
public class SortedPrinterOutputTest extends RuleTest {

    @Override
    protected String getInputFilePath() {
        return "SortedPrinterOutputTest.swift";
    }

    @Override
    protected void addAllExpectedMsgs() {
        addExpectedMsg(1, 18, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(3, 25, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(6, 15, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(7, 15, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(9, 14, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(8, 14, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(9, 14, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(10, 2, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(13, 33, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(14, 29, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(15, 23, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(16, 39, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(17, 2, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(20, 8, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(21, 18, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(27, 10, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(31, 10, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(33, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(33, 2, Messages.ERROR, Messages.STATEMENTS);
        addExpectedMsg(64, 2, Messages.ERROR, Messages.STATEMENTS);
    }

    private void addExpectedMsg(int line, String classification, String msg) {
        expectedMessages.add(
                Printer.genOutputStringForTest(
                        inputFile.getName(), line, classification, msg + Messages.SEMICOLON));
    }

    private void addExpectedMsg(int line, int column, String classification, String msg) {
        expectedMessages.add(
                Printer.genOutputStringForTest(
                        inputFile.getName(), line, column, classification, msg + Messages.SEMICOLON));
    }

}

@@ -575,32 +575,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -664,32 +664,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -753,32 +753,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -854,56 +854,10 @@
 ENTS
-);%0A        addExpectedMsg(9, 14, Messages.ERROR,
+ +
  Mes
@@ -859,33 +859,32 @@
 + Messages.S
-TATEMENTS
+EMICOLON
 );%0A        a
@@ -931,32 +931,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1020,32 +1020,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1109,32 +1109,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1199,32 +1199,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1289,32 +1289,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1379,32 +1379,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1469,32 +1469,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1558,32 +1558,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1643,32 +1643,72 @@
  Messages.ST
-ATEMENTS
+RUCT + Messages.NAMES+ Messages.UPPER_CAMEL_CASE
 );%0A        a
@@ -1756,32 +1756,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1846,32 +1846,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -1936,32 +1936,53 @@
 sages.STATEMENTS
+ + Messages.SEMICOLON
 );%0A        addEx
@@ -2016,34 +2016,58 @@
 R, Messages.
-STATEMENTS
+FILE + Messages.NEWLINE_TERMINATOR
 );%0A        a
@@ -2126,56 +2126,10 @@
 ENTS
-);%0A        addExpectedMsg(64, 2, Messages.ERROR,
+ +
  Mes
@@ -2135,25 +2135,24 @@
 ssages.S
-TATEMENTS
+EMICOLON
 );%0A    %7D
@@ -2380,37 +2380,16 @@
 ion, msg
- + Messages.SEMICOLON
 ));%0A    
@@ -2552,32 +2552,32 @@
 tStringForTest(%0A
+
                 
@@ -2638,37 +2638,16 @@
 ion, msg
- + Messages.SEMICOLON
 ));%0A    

Fix broken tests