SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
1.5 KiB

package de.superx.util;
import static org.junit.Assert.*;
import org.junit.Assert;
import org.junit.Test;
public class SqlStringUtilsTest {
@SuppressWarnings("static-method")
@Test
public void testSQLProcessingMarkerFunctions() {
// test "hasSQLProcessingMarker"
Assert.assertTrue("Expected marker to be found", SqlStringUtils.hasSQLProcessingMarker("<<SQL>> bla blub"));
Assert.assertFalse("Expected no marker to be found", SqlStringUtils.hasSQLProcessingMarker(null));
Assert.assertFalse("Expected no marker to be found", SqlStringUtils.hasSQLProcessingMarker("<<SQL>"));
Assert.assertFalse("Expected no marker to be found", SqlStringUtils.hasSQLProcessingMarker("<<sql>> bla blub"));
Assert.assertFalse("Expected no marker to be found", SqlStringUtils.hasSQLProcessingMarker("asdfasdf<<SQL>>"));
// test
Assert.assertEquals("Expected marker to be removed", " bla bla", SqlStringUtils.removeSQLProcessingMarker("<<SQL>> bla bla"));
Assert.assertEquals("Expected marker to be removed", "", SqlStringUtils.removeSQLProcessingMarker("<<SQL>>"));
Assert.assertEquals("Expected no marker to be removed", "<<sql>> bla bla", SqlStringUtils.removeSQLProcessingMarker("<<sql>> bla bla"));
Assert.assertEquals("Expected no marker to be removed", " bla bla", SqlStringUtils.removeSQLProcessingMarker(" bla bla"));
Assert.assertNull("Expected no marker to be removed", SqlStringUtils.removeSQLProcessingMarker(null));
}
}