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 constant naming rule
 */
@RunWith(MockitoJUnitRunner.class)
public class ConstantNamingTest extends RuleTest {

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

    @Override
    protected void addAllExpectedMsgs() {
        addExpectedMsg(2, 5, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(11, 13, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(12, 15, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(20, 5, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(24, 5, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(56, 5, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(67, 9, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);
        addExpectedMsg(78, 9, Messages.ERROR, Messages.GLOBAL + Messages.CONSTANT + Messages.GLOBAL_CONSTANT_NAMING);

        addExpectedMsg(5, 16, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(5, 45, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(15, 9, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(29, 33, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(29, 19, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(30, 7, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(31, 7, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(33, 7, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(40, 14, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(50, 11, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(87, 17, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(94, 8, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(104, 14, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(111, 51, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(116, 61, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);
        addExpectedMsg(117, 3, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);

        // K PREFIX TESTS
        addExpectedMsg(2, 22, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(2, 37, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(79, 16, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(79, 16, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(126, 16, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(127, 16, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(132, 20, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);
        addExpectedMsg(133, 20, Messages.ERROR, Messages.CONSTANT + Messages.CONSTANT_NAMING);

    }

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

}

@@ -3303,115 +3303,8 @@
 D);%0A
-        addExpectedMsg(79, 16, Messages.WARNING, Messages.CONSTANT + Messages.NAME + Messages.K_PREFIXED);%0A
     

Remove duplicate expected message