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.
25 lines
1.0 KiB
25 lines
1.0 KiB
package de.superx.sec; |
|
|
|
import org.junit.Assert; |
|
import org.junit.Test; |
|
|
|
public class MatrikelnummernCheckTest { |
|
|
|
// this input check explicitly allows input, that caused an injection in some special cases(!) |
|
// so it has to be assured, that it is only configured contexts, where this is not the case |
|
private static String[] SAMPLES_FOR_VALID_FORMAT = {"", "091279142", " 12312", "12347 ", " 12039874 ,123", "927 , 2134987 "}; |
|
private static String[] SAMPLES_FOR_INVALID_FORMAT = {";", "230948, ,", "402349a"}; |
|
|
|
@SuppressWarnings("static-method") |
|
@Test |
|
public void testConfirmFormat() { |
|
InputCheck testee = new MatrikelnummernCheck(); |
|
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)); |
|
} |
|
} |
|
|
|
}
|
|
|