@@ -0,0 +1,2876 @@
+package com.sleekbyte.tailor.functional;%0A%0Aimport com.sleekbyte.tailor.Tailor;%0Aimport com.sleekbyte.tailor.common.Messages;%0Aimport com.sleekbyte.tailor.output.Printer;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0A/**%0A * Functional tests for ConstructLength rule%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ConstructLengthTest %7B%0A%0A    private static final String NEWLINE_REGEX = %22%5C%5Cr?%5C%5Cn%22;%0A%0A    private ByteArrayOutputStream outContent;%0A    private File inputFile = new File(%22src/test/java/com/sleekbyte/tailor/functional/ConstructLengthTest.swift%22);%0A    private Set%3CString%3E expectedMessages = new HashSet%3C%3E();%0A%0A    @Before%0A    public void setUp() %7B%0A        outContent = new ByteArrayOutputStream();%0A        System.setOut(new PrintStream(outContent));%0A    %7D%0A%0A    @After%0A    public void tearDown() %7B%0A        System.setOut(null);%0A    %7D%0A%0A    @Test%0A    public void testConstructLength() throws IOException %7B%0A        String%5B%5D command = %7B%0A            %22--max-class-length%22, %228%22,%0A            %22--max-closure-length%22, %226%22,%0A            %22--max-file-length%22, %2230%22,%0A            %22--max-function-length%22, %223%22,%0A            %22--max-struct-length%22, %221%22,%0A            inputFile.getPath()%0A        %7D;%0A%0A        addExpectedMsg(Messages.CLASS, 8, 16, Messages.ERROR, 12, 8);%0A        addExpectedMsg(Messages.CLOSURE, 24, 27, Messages.ERROR, 8, 6);%0A        addExpectedMsg(Messages.FILE, 31, 1, Messages.ERROR, 39, 30);%0A        addExpectedMsg(Messages.FUNCTION, 10, 67, Messages.ERROR, 9, 3);%0A        addExpectedMsg(Messages.FUNCTION, 12, 35, Messages.ERROR, 5, 3);%0A        addExpectedMsg(Messages.STRUCT, 35, 19, Messages.ERROR, 3, 1);%0A%0A        Tailor.main(command);%0A%0A        Set%3CString%3E actualOutput = new HashSet%3C%3E();%0A        for (String msg : outContent.toString().split(NEWLINE_REGEX)) %7B%0A            String truncatedMsg = msg.substring(msg.indexOf(inputFile.getName()));%0A            actualOutput.add(truncatedMsg);%0A        %7D%0A%0A        // TODO: Use %60==%60 once #33 %22Buffer output in printer class and remove duplicateMessages.ERROR messages%22 is complete%0A        assertTrue(actualOutput.size() %3E= expectedMessages.size());%0A        assertTrue(actualOutput.containsAll(expectedMessages));%0A    %7D%0A%0A    private void addExpectedMsg(String msg, int line, int column, String classification, int length, int limit) %7B%0A        String lengthVersusLimit = %22 (%22 + length + %22/%22 + limit + %22)%22;%0A        expectedMessages.add(%0A            Printer.genOutputStringForTest(%0A                inputFile.getName(), msg + Messages.EXCEEDS_LINE_LIMIT + lengthVersusLimit, line, column, classification));%0A    %7D%0A%0A%7D%0A

Add functional tests for construct length rule