From 4207d7d2da81b74a31b639bae9502593bee4bc3c Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 8 Sep 2020 15:15:25 +0200 Subject: add additional jUnit tests --- .../moa/id/util/ParamValidatorUtilsTest.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'id/server/idserverlib/src/test/java') diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/ParamValidatorUtilsTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/ParamValidatorUtilsTest.java index 7afad55aa..d7cc2bd3a 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/ParamValidatorUtilsTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/ParamValidatorUtilsTest.java @@ -170,6 +170,36 @@ public class ParamValidatorUtilsTest { } + @Test + public void templateLazyWithUsernameFirst() { + + HttpServletRequest req = getDummyHttpRequest("junit.com"); + String template = "https://junit.com@https://wrong.com/cccc"; + List oaSlTemplates = Arrays.asList( + "http://aaaa.com/bbbb", + "https://aaaa.com/bbbb", + "file://aaaa.com/bbbb"); + + Assert.assertFalse("Template should be valid", + ParamValidatorUtils.isValidTemplate(req, template, oaSlTemplates, false)); + + } + + @Test + public void templateLazyWithUsernameSecond() { + + HttpServletRequest req = getDummyHttpRequest("junit.com"); + String template = "https://junit.com@wrong.com/cccc"; + List oaSlTemplates = Arrays.asList( + "http://aaaa.com/bbbb", + "https://aaaa.com/bbbb", + "file://aaaa.com/bbbb"); + + Assert.assertFalse("Template should be valid", + ParamValidatorUtils.isValidTemplate(req, template, oaSlTemplates, false)); + + } + @Test public void templateLazyWhitelistSeven() { -- cgit v1.2.3