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
985 B
25 lines
985 B
package de.superx.sec; |
|
|
|
import java.util.Set; |
|
|
|
import org.junit.Assert; |
|
import org.junit.Test; |
|
|
|
public class HttpGetAccessListParserTest { |
|
|
|
@Test |
|
public void testParser() { |
|
String validInput = "# ein Kommentar\n\n \r#comment\r1234\r\n"; |
|
Set<Integer> validList = HttpGetAccessListParser.parseList(validInput); |
|
Assert.assertTrue("id '1234' should be parsed from input", validList.contains(Integer.valueOf(1234))); |
|
Assert.assertFalse("id '123' should _not_ be parsed from input", validList.contains(Integer.valueOf(123))); |
|
String invalidInput = "# ein Kommentar\n12a34\n \r#comment\r1234\r\n"; |
|
Set<Integer> invalidList = null; |
|
try { |
|
invalidList = HttpGetAccessListParser.parseList(invalidInput); |
|
} catch(NumberFormatException e) { |
|
// exception should be thrown :) |
|
} |
|
Assert.assertNull("'invalidList' should _not_ have been parsed and this be 'null'", invalidList); |
|
} |
|
}
|
|
|