add UriType and CronExpression validators

This commit is contained in:
Shinsuke Sugaya 2015-12-26 21:41:59 +09:00
parent be89400358
commit 8c1369fd8f
19 changed files with 324 additions and 336 deletions

View file

@ -1,50 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.codelibs.core.lang.StringUtil;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
//@Validator("cronExpression")
public @interface CronExpression {
/**
* A validation message.
*
* @return
*/
//Msg msg() default @Msg(key = "errors.cronexpression");
/**
* Argument for a message
*
* @return
*/
//Arg arg0() default @Arg(key = StringUtil.EMPTY);
/**
* a target name for this validation
*
* @return
*/
String target() default StringUtil.EMPTY;
}

View file

@ -1,35 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author shinsuke
*
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Token {
boolean save();
boolean validate();
boolean keep() default false;
}

View file

@ -1,53 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.codelibs.core.lang.StringUtil;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
//@Validator("uriType")
public @interface UriType {
String protocols();
/**
* A validation message.
*
* @return
*/
//Msg msg() default @Msg(key = "errors.cronexpression");
/**
* Argument for a message
*
* @return
*/
//Arg arg0() default @Arg(key = StringUtil.EMPTY);
/**
* a target name for this validation
*
* @return
*/
String target() default StringUtil.EMPTY;
}

View file

@ -1,31 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author shinsuke
*
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface User {
}

View file

@ -23,10 +23,10 @@ import javax.validation.constraints.Size;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.annotation.UriType;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.StreamUtil;
import org.codelibs.fess.validation.UriType;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
@ -50,7 +50,7 @@ public class CreateForm implements Serializable {
public String name;
@Required
@UriType(protocols = "file:,smb:")
@UriType(protocols = { "file:", "smb:" })
@Size(max = 4000)
public String paths;

View file

@ -22,8 +22,8 @@ import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import org.codelibs.fess.Constants;
import org.codelibs.fess.annotation.CronExpression;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.validation.CronExpression;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;

View file

@ -23,10 +23,10 @@ import javax.validation.constraints.Size;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.annotation.UriType;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.StreamUtil;
import org.codelibs.fess.validation.UriType;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
@ -51,7 +51,7 @@ public class CreateForm implements Serializable {
public String name;
@Required
@UriType(protocols = "http:,https:")
@UriType(protocols = { "http:", "https:" })
@Size(max = 4000)
public String urls;

View file

@ -140,6 +140,12 @@ public class FessMessages extends FessLabels {
/** The key of the message: {item} cannot convert as {propertyType}. */
public static final String CONSTRAINTS_TypeAny_MESSAGE = "{constraints.TypeAny.message}";
/** The key of the message: {item} has wrong URI. */
public static final String CONSTRAINTS_UriType_MESSAGE = "{constraints.UriType.message}";
/** The key of the message: {item} is invalid cron expression. */
public static final String CONSTRAINTS_CronExpression_MESSAGE = "{constraints.CronExpression.message}";
/** The key of the message: Login failed. */
public static final String ERRORS_LOGIN_FAILURE = "{errors.login.failure}";
@ -932,6 +938,36 @@ public class FessMessages extends FessLabels {
return this;
}
/**
* Add the created action message for the key 'constraints.UriType.message' with parameters.
* <pre>
* message: {item} has wrong URI.
* </pre>
* @param property The property name for the message. (NotNull)
* @param item The parameter item for message. (NotNull)
* @return this. (NotNull)
*/
public FessMessages addConstraintsUriTypeMessage(String property, String item) {
assertPropertyNotNull(property);
add(property, new ActionMessage(CONSTRAINTS_UriType_MESSAGE, item));
return this;
}
/**
* Add the created action message for the key 'constraints.CronExpression.message' with parameters.
* <pre>
* message: {item} is invalid cron expression.
* </pre>
* @param property The property name for the message. (NotNull)
* @param item The parameter item for message. (NotNull)
* @return this. (NotNull)
*/
public FessMessages addConstraintsCronExpressionMessage(String property, String item) {
assertPropertyNotNull(property);
add(property, new ActionMessage(CONSTRAINTS_CronExpression_MESSAGE, item));
return this;
}
/**
* Add the created action message for the key 'errors.login.failure' with parameters.
* <pre>

View file

@ -0,0 +1,44 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validation;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = CronExpressionValidator.class)
public @interface CronExpression {
String message() default "{org.lastaflute.validator.constraints.CronExpression.message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.codelibs.core.lang.StringUtil;
public class CronExpressionValidator implements ConstraintValidator<CronExpression, String> {
@Override
public void initialize(CronExpression constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return determineValid(value);
}
protected boolean determineValid(String value) {
if (StringUtil.isNotBlank(value) && !org.quartz.CronExpression.isValidExpression(value)) {
return false;
}
return true;
}
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validation;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = UriTypeValidator.class)
public @interface UriType {
String[] protocols();
String message() default "{org.lastaflute.validator.constraints.UriType.message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

View file

@ -0,0 +1,61 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validation;
import javax.validation.ConstraintDefinitionException;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.codelibs.core.lang.StringUtil;
public class UriTypeValidator implements ConstraintValidator<UriType, String> {
private String[] protocols;
@Override
public void initialize(UriType uriType) {
protocols = uriType.protocols();
if (protocols == null || protocols.length == 0) {
throw new ConstraintDefinitionException("protocols is emtpy.");
}
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
if (StringUtil.isNotBlank(value)) {
return check(protocols, value);
}
return true;
}
protected static boolean check(final String[] protocols, final String value) {
final String[] paths = value.split("[\r\n]");
for (final String path : paths) {
if (StringUtil.isNotBlank(path) && !path.trim().startsWith("#")) {
boolean flag = false;
for (final String protocol : protocols) {
if (path.trim().startsWith(protocol.trim())) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
}
return true;
}
}

View file

@ -1,20 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validator;
//TODO replace with hibernate validator
public class CronExpressionChecks /*extends S2FieldChecks*/{
}

View file

@ -1,59 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validator;
import org.codelibs.core.lang.StringUtil;
// TODO replace with hibernate validator
public class UriTypeChecks /*extends S2FieldChecks*/{
/*
public static boolean validateUriType(final Object bean, final ValidatorAction validatorAction, final Field field,
final ActionMessages errors, final Validator validator, final HttpServletRequest request) {
final String value = getValueAsString(bean, field);
if (StringUtil.isNotBlank(value)) {
final String protocols = field.getVarValue("protocols");
if (StringUtil.isEmpty(protocols)) {
throw new FessSystemException("protocols is empty.");
}
if (!check(protocols, value)) {
addError(errors, field, validator, validatorAction, request);
return false;
}
}
return true;
}
*/
protected static boolean check(final String protocols, final String values) {
final String[] prtcls = protocols.split(",");
final String[] paths = values.split("[\r\n]");
for (final String path : paths) {
if (StringUtil.isNotBlank(path) && !path.trim().startsWith("#")) {
boolean flag = false;
for (final String protocol : prtcls) {
if (path.trim().startsWith(protocol.trim())) {
flag = true;
break;
}
}
if (!flag) {
return false;
}
}
}
return true;
}
}

View file

@ -51,6 +51,8 @@ constraints.TypeLong.message = {item} should be numeric.
constraints.TypeFloat.message = {item} should be numeric.
constraints.TypeDouble.message = {item} should be numeric.
constraints.TypeAny.message = {item} cannot convert as {propertyType}.
constraints.UriType.message = {item} has wrong URI.
constraints.CronExpression.message = {item} is invalid cron expression.
# ----------------------------------------------------------
# Application Exception

View file

@ -51,6 +51,8 @@ constraints.TypeLong.message = {item} should be numeric.
constraints.TypeFloat.message = {item} should be numeric.
constraints.TypeDouble.message = {item} should be numeric.
constraints.TypeAny.message = {item} cannot convert as {propertyType}.
constraints.UriType.message = {item} has wrong URI.
constraints.CronExpression.message = {item} is invalid cron expression.
# ----------------------------------------------------------
# Application Exception

View file

@ -48,6 +48,9 @@ constraints.TypeLong.message = {item} \u306f\u6570\u5024\u3067\u306a\u3051\u308c
constraints.TypeFloat.message = {item} \u306f\u6570\u5024\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
constraints.TypeDouble.message = {item} \u306f\u6570\u5024\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
constraints.TypeAny.message = {item} \u306f {propertyType} \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002
constraints.UriType.message = {item} \u306b\u8a8d\u8b58\u3067\u304d\u306a\u3044 URI \u304c\u3042\u308a\u307e\u3059\u3002
constraints.CronExpression.message = {item} \u306f\u6b63\u3057\u3044 CRON \u8868\u8a18\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
# ----------------------------------------------------------
# Application Exception
# ---------------------

View file

@ -0,0 +1,84 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validation;
import org.codelibs.fess.unit.UnitFessTestCase;
import org.codelibs.fess.validation.UriTypeValidator;
public class UriTypeValidatorTest extends UnitFessTestCase {
public void test_check_ok() {
String[] protocols;
String values;
protocols = new String[] { "http:" };
values = "http://www.foo.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "http://www.foo.com/\nhttp://www.bar.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "http://www.foo.com/ \r\nhttp://www.bar.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "http://www.foo.com/\nhttp://www.bar.com/\n http://www.baz.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:", "https:" };
values = "https://www.foo.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:", "https:" };
values = "http://www.foo.com/\r\nhttp://www.bar.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:", "https:" };
values = "http://www.foo.com/\nhttps://www.bar.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:", "https:" };
values = "http://www.foo.com/\n \nhttps://www.bar.com/";
assertTrue(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:", "https:" };
values = "http://www.foo.com/\nhttps://www.bar.com/\n http://www.baz.com/";
assertTrue(UriTypeValidator.check(protocols, values));
}
public void test_check_ng() {
String[] protocols;
String values;
protocols = new String[] { "http:" };
values = "https://www.foo.com/";
assertFalse(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "https://www.foo.com/\nhttps://www.bar.com/";
assertFalse(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "https://www.foo.com/\n \nhttps://www.bar.com/";
assertFalse(UriTypeValidator.check(protocols, values));
protocols = new String[] { "http:" };
values = "https://www.foo.com/\nhttps://www.bar.com/\n https://www.baz.com/";
assertFalse(UriTypeValidator.check(protocols, values));
}
}

View file

@ -1,83 +0,0 @@
/*
* Copyright 2012-2015 CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.validator;
import org.codelibs.fess.unit.UnitFessTestCase;
public class UriTypeChecksTest extends UnitFessTestCase {
public void test_check_ok() {
String protocols;
String values;
protocols = "http:";
values = "http://www.foo.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "http://www.foo.com/\nhttp://www.bar.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "http://www.foo.com/ \r\nhttp://www.bar.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "http://www.foo.com/\nhttp://www.bar.com/\n http://www.baz.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:,https:";
values = "https://www.foo.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:,https:";
values = "http://www.foo.com/\r\nhttp://www.bar.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:,https:";
values = "http://www.foo.com/\nhttps://www.bar.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:,https:";
values = "http://www.foo.com/\n \nhttps://www.bar.com/";
assertTrue(UriTypeChecks.check(protocols, values));
protocols = "http:, https:";
values = "http://www.foo.com/\nhttps://www.bar.com/\n http://www.baz.com/";
assertTrue(UriTypeChecks.check(protocols, values));
}
public void test_check_ng() {
String protocols;
String values;
protocols = "http:";
values = "https://www.foo.com/";
assertFalse(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "https://www.foo.com/\nhttps://www.bar.com/";
assertFalse(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "https://www.foo.com/\n \nhttps://www.bar.com/";
assertFalse(UriTypeChecks.check(protocols, values));
protocols = "http:";
values = "https://www.foo.com/\nhttps://www.bar.com/\n https://www.baz.com/";
assertFalse(UriTypeChecks.check(protocols, values));
}
}