package com.iqser.red.service.peristence.v1.server.integration.tests;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.StringCleaningUtility;

public class StringCleaningUtilityTest {

    @Test
    public void testRemoveLinebreaks() {

        String originalValue = "abc\ndef";
        assertEquals("abc def", StringCleaningUtility.cleanString(originalValue));

    }


    @Test
    public void testRemoveHyphenLinebreaks() {

        String originalValue = "abc-\ndef";
        assertEquals("abcdef", StringCleaningUtility.cleanString(originalValue));

    }


    @Test
    public void testDontRemoveHyphens() {

        String originalValue = "abc-def";
        assertEquals("abc-def", StringCleaningUtility.cleanString(originalValue));

    }


    @Test
    public void testRemoveDoubleWhiteSpace() {

        String originalValue = "abc  def";
        assertEquals("abc def", StringCleaningUtility.cleanString(originalValue));
    }


    @Test
    public void testAllAboveInOne() {

        String originalValue = "abc\n def, ghi-jkl\n\nmno-\npqr";
        assertEquals("abc def, ghi-jkl mnopqr", StringCleaningUtility.cleanString(originalValue));
    }

}
