package de.felixschulze.teamcity;

import org.junit.Test;

import static junit.framework.Assert.assertEquals;

public class TeamCityStatusMessageHelperTest {

    @Test
    public void testShouldEscapeString() {
        String exampleString = "Test|Test'Test\"Test\\nTest\\rTest[Test]";
        String escapedString = TeamCityStatusMessageHelper.escapeString(exampleString);
        assertEquals("Test||Test|'Test|'Test\\nTest\\rTest|[Test|]", escapedString);
    }

    @Test
    public void testShouldCreateVersionLog() {
        String versionLog = TeamCityStatusMessageHelper.buildNumberString("3.7");
        assertEquals("##teamcity[buildNumber '3.7']", versionLog);
    }

    @Test
    public void testShouldCreateBuildStatusFailureLog() {
        String buildStatusFailureLog = TeamCityStatusMessageHelper.buildStatusFailureString(TeamCityStatusType.FAILURE, "Tests failed - The app may be crashed");
        assertEquals("##teamcity[buildStatus status='FAILURE' text='Tests failed - The app may be crashed']", buildStatusFailureLog);
    }

}

@@ -1044,10 +1044,308 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testShouldCreateImportDataLog() %7B%0A        String importDataLog = TeamCityStatusMessageHelper.importDataString(TeamCityImportDataType.JUNIT, %22/example/junit.xml%22);%0A        assertEquals(%22##teamcity%5BimportData type='junit' path='/example/junit.xml'%5D%22, importDataLog);%0A    %7D%0A%0A
 %7D%0A

Add test for importData