package de.superx.sec; import org.junit.Assert; import org.junit.Test; public class DefaultCheckTest { private static String[] SAMPLES_FOR_VALID_FORMAT = {"", "135€", "Marçel", "Søren", "Rathausstraße", "info@mailinator.com", "line 1\r\nline 2", "test^csv^upload^functionality"}; private static String[] SAMPLES_FOR_INVALID_FORMAT = {";", "1,2,3,4,5", "sp_get_keylist_str($$bla1$$,$$bla2$$)::INT"}; @SuppressWarnings("static-method") @Test public void testConfirmFormat() { DefaultCheck testee = new DefaultCheck(); for (String sample : SAMPLES_FOR_VALID_FORMAT) { Assert.assertTrue("expected '" + sample + "' to be valid pattern", testee.check(sample)); } for (String sample : SAMPLES_FOR_INVALID_FORMAT) { Assert.assertFalse("expected '" + sample + "' to be invalid pattern", testee.check(sample)); } } }