This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch feature/SLING-13068-parent-65 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-validation-impl.git
commit 40f5375268f6285defc7e62f9b9bedb7de2321de Author: Stefan Seifert <[email protected]> AuthorDate: Thu Jan 29 21:02:16 2026 +0100 SLING-13068 apply spotless formatting --- pom.xml | 14 ++--- .../validation/InvalidResourceException.java | 43 +++++++------- .../impl/ModelValidationConfiguration.java | 10 +++- .../validation/impl/ModelValidationImpl.java | 68 +++++++++++++--------- .../validation/impl/it/GenerateTestBundle.java | 17 +++--- .../testbundle/models/ModelValidationDisabled.java | 34 ++++++----- .../testbundle/models/ModelValidationOptional.java | 34 ++++++----- .../testbundle/models/ModelValidationRequired.java | 34 ++++++----- .../impl/it/testing/ModelValidationIT.java | 51 +++++++++------- 9 files changed, 170 insertions(+), 135 deletions(-) diff --git a/pom.xml b/pom.xml index 0a4257a..2fde2fc 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,13 @@ <name>Apache Sling Models Validation Implementation</name> <description>Validation Implementation which leverages Sling Validation</description> + <scm> + <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-validation-impl.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-validation-impl.git</developerConnection> + <tag>HEAD</tag> + <url>https://github.com/apache/sling-org-apache-sling-models-validation-impl.git</url> + </scm> + <properties> <project.build.outputTimestamp>2021-12-07T08:24:38Z</project.build.outputTimestamp> <sling.java.version>11</sling.java.version> @@ -43,13 +50,6 @@ <it.models.log.level>debug</it.models.log.level> </properties> - <scm> - <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-validation-impl.git</connection> - <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-validation-impl.git</developerConnection> - <url>https://github.com/apache/sling-org-apache-sling-models-validation-impl.git</url> - <tag>HEAD</tag> - </scm> - <dependencies> <dependency> <groupId>org.osgi</groupId> diff --git a/src/main/java/org/apache/sling/models/validation/InvalidResourceException.java b/src/main/java/org/apache/sling/models/validation/InvalidResourceException.java index 7677e7e..c7193e6 100644 --- a/src/main/java/org/apache/sling/models/validation/InvalidResourceException.java +++ b/src/main/java/org/apache/sling/models/validation/InvalidResourceException.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation; @@ -29,37 +31,38 @@ import org.osgi.annotation.versioning.ProviderType; public final class InvalidResourceException extends InvalidModelException { /** - * + * */ private static final long serialVersionUID = -5134512515466089688L; + private final ValidationResult result; private final String path; - + public InvalidResourceException(String message, ValidationResult result, String path) { super(message); this.result = result; this.path = path; } - + /** - * + * * @return the underlying {@link ValidationResult} */ public ValidationResult getResult() { return result; } - + /** - * + * * @return the path of the resource which was considered invalid */ public String getPath() { return path; } - + public String getMessage() { StringBuilder builder = new StringBuilder("Validation errors for "); - builder.append("'" + path +"':"); + builder.append("'" + path + "':"); for (ValidationFailure failure : result.getFailures()) { builder.append("\n" + failure.getLocation() + ":" + failure.getMessage(null) + "\n\t"); } diff --git a/src/main/java/org/apache/sling/models/validation/impl/ModelValidationConfiguration.java b/src/main/java/org/apache/sling/models/validation/impl/ModelValidationConfiguration.java index c7e2b88..d44e7e2 100644 --- a/src/main/java/org/apache/sling/models/validation/impl/ModelValidationConfiguration.java +++ b/src/main/java/org/apache/sling/models/validation/impl/ModelValidationConfiguration.java @@ -21,10 +21,16 @@ package org.apache.sling.models.validation.impl; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.ObjectClassDefinition; -@ObjectClassDefinition(name = "Apache Sling Models Validation Configuration (for Sling Validation)", description = "Allows to configure how Sling Models are validated with the help of Sling Validation") +@ObjectClassDefinition( + name = "Apache Sling Models Validation Configuration (for Sling Validation)", + description = "Allows to configure how Sling Models are validated with the help of Sling Validation") public @interface ModelValidationConfiguration { @AttributeDefinition(name = "Disabled") boolean disabled() default false; - @AttributeDefinition(name = "Severity Threshold", description = "This threshold specifies the minimum severity of the underlying Sling validation failures for making a Sling Model invalid. If all validation failures are below that threshold the model is considered valid.") + + @AttributeDefinition( + name = "Severity Threshold", + description = + "This threshold specifies the minimum severity of the underlying Sling validation failures for making a Sling Model invalid. If all validation failures are below that threshold the model is considered valid.") int severityThreshold() default 0; } diff --git a/src/main/java/org/apache/sling/models/validation/impl/ModelValidationImpl.java b/src/main/java/org/apache/sling/models/validation/impl/ModelValidationImpl.java index b5b980a..2d73f7e 100644 --- a/src/main/java/org/apache/sling/models/validation/impl/ModelValidationImpl.java +++ b/src/main/java/org/apache/sling/models/validation/impl/ModelValidationImpl.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation.impl; @@ -41,53 +43,59 @@ import org.slf4j.LoggerFactory; * @see <a href="http://sling.apache.org/documentation/bundles/validation.html">Sling Validation</a> */ @Component -@Designate(ocd=ModelValidationConfiguration.class) +@Designate(ocd = ModelValidationConfiguration.class) public class ModelValidationImpl implements ModelValidation { @Reference private ValidationService validation; - + private ModelValidationConfiguration configuration; - + private static final Logger log = LoggerFactory.getLogger(ModelValidationImpl.class); - + @Activate protected void activate(ModelValidationConfiguration configuration) { this.configuration = configuration; } - + /** * Triggers validation for the given model on the given adaptable. * @param adaptable {@inheritDoc} * @param modelClass {@inheritDoc} * @param required {@inheritDoc} - * @return a {@link ValidationException} in case validation could not be performed if validation model could not be performed but + * @return a {@link ValidationException} in case validation could not be performed if validation model could not be performed but * required=true or if the adaptable is neither a Resource nor a SlingHttpServletRequest. * Or a {@link InvalidResourceException} in case the given resource (in the adaptable) could not be validated through the {@link ModelValidation}. */ - public <ModelType> RuntimeException validate(Object adaptable, Class<ModelType> modelClass, boolean required) throws ValidationException, InvalidModelException { + public <ModelType> RuntimeException validate(Object adaptable, Class<ModelType> modelClass, boolean required) + throws ValidationException, InvalidModelException { if (configuration.disabled()) { - log.debug("Skip validation of model {}, because validation is disabled through the OSGi configuration for ModelValidationConfiguration", modelClass); + log.debug( + "Skip validation of model {}, because validation is disabled through the OSGi configuration for ModelValidationConfiguration", + modelClass); return null; } Resource resource = null; if (adaptable instanceof SlingHttpServletRequest) { - resource = ((SlingHttpServletRequest)adaptable).getResource(); + resource = ((SlingHttpServletRequest) adaptable).getResource(); } else if (adaptable instanceof Resource) { - resource = (Resource)adaptable; + resource = (Resource) adaptable; } if (resource != null) { return validate(resource, required); } else { - return new ValidationException("Sling Validation can only be performed if model is adapted from either SlingHttpServletRequest or Resource."); + return new ValidationException( + "Sling Validation can only be performed if model is adapted from either SlingHttpServletRequest or Resource."); } } - + private RuntimeException validate(@NotNull Resource resource, boolean required) { try { ValidationModel validationModel = validation.getValidationModel(resource, true); if (validationModel == null) { - String error = String.format("Could not find validation model for resource '%s' with type '%s'", resource.getPath(), resource.getResourceType()); + String error = String.format( + "Could not find validation model for resource '%s' with type '%s'", + resource.getPath(), resource.getResourceType()); if (required) { return new ValidationException(error); } else { @@ -106,10 +114,14 @@ public class ModelValidationImpl implements ModelValidation { } } if (shouldThrow) { - return new InvalidResourceException("Sling Model is invalid", validationResult, resource.getPath()); + return new InvalidResourceException( + "Sling Model is invalid", validationResult, resource.getPath()); } else { - log.debug("Although the resource {} is considered invalid by Sling Validation, all validation failures have a severity below the threshold '{}', " - + "therefore considering this Sling Model valid.", resource.getPath(), configuration.severityThreshold()); + log.debug( + "Although the resource {} is considered invalid by Sling Validation, all validation failures have a severity below the threshold '{}', " + + "therefore considering this Sling Model valid.", + resource.getPath(), + configuration.severityThreshold()); } } } catch (SlingValidationException e) { diff --git a/src/test/java/org/apache/sling/models/validation/impl/it/GenerateTestBundle.java b/src/test/java/org/apache/sling/models/validation/impl/it/GenerateTestBundle.java index b2994da..a6c279d 100644 --- a/src/test/java/org/apache/sling/models/validation/impl/it/GenerateTestBundle.java +++ b/src/test/java/org/apache/sling/models/validation/impl/it/GenerateTestBundle.java @@ -29,15 +29,14 @@ import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassInfo; +import io.github.classgraph.ScanResult; import org.apache.sling.models.annotations.Model; import org.ops4j.pax.tinybundles.TinyBundle; import org.ops4j.pax.tinybundles.TinyBundles; import org.osgi.framework.Constants; -import io.github.classgraph.ClassGraph; -import io.github.classgraph.ClassInfo; -import io.github.classgraph.ScanResult; - /** * This uses tinybundles to create a test bundle that is deployed to sling * starter. The test bundle contains all classes from the packages @@ -77,7 +76,9 @@ public class GenerateTestBundle { bundle.setHeader("Sling-Model-Classes", modelClassNames.stream().collect(Collectors.joining(","))); // add all test resources from SLING-CONTENT - bundle.setHeader("Sling-Initial-Content", "SLING-CONTENT/apps/sling/validation;overwrite:=true;path:=/apps/sling/validation"); + bundle.setHeader( + "Sling-Initial-Content", + "SLING-CONTENT/apps/sling/validation;overwrite:=true;path:=/apps/sling/validation"); addTestResources(bundle); return bundle; @@ -99,11 +100,9 @@ public class GenerateTestBundle { * Add all test resources from SLING-CONTENT directory to the bundle. */ static void addTestResources(TinyBundle bundle) { - try (ScanResult scanResult = new ClassGraph() - .acceptPaths("SLING-CONTENT") - .scan()) { + try (ScanResult scanResult = + new ClassGraph().acceptPaths("SLING-CONTENT").scan()) { scanResult.getAllResources().forEach(resource -> bundle.addResource(resource.getPath(), resource.getURL())); } } - } diff --git a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationDisabled.java b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationDisabled.java index 4543300..dfde75e 100644 --- a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationDisabled.java +++ b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationDisabled.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation.impl.it.testbundle.models; @@ -20,7 +22,7 @@ import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.ValidationStrategy; -@Model(validation=ValidationStrategy.DISABLED, adaptables = { Resource.class }) -public class ModelValidationDisabled { - -} +@Model( + validation = ValidationStrategy.DISABLED, + adaptables = {Resource.class}) +public class ModelValidationDisabled {} diff --git a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationOptional.java b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationOptional.java index 63d2c7d..6571d0a 100644 --- a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationOptional.java +++ b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationOptional.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation.impl.it.testbundle.models; @@ -20,7 +22,7 @@ import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.ValidationStrategy; -@Model(validation=ValidationStrategy.OPTIONAL, adaptables = { Resource.class }) -public class ModelValidationOptional { - -} +@Model( + validation = ValidationStrategy.OPTIONAL, + adaptables = {Resource.class}) +public class ModelValidationOptional {} diff --git a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationRequired.java b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationRequired.java index 8c9871a..69827cd 100644 --- a/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationRequired.java +++ b/src/test/java/org/apache/sling/models/validation/impl/it/testbundle/models/ModelValidationRequired.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation.impl.it.testbundle.models; @@ -20,7 +22,7 @@ import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.ValidationStrategy; -@Model(validation=ValidationStrategy.REQUIRED, adaptables = { Resource.class }) -public class ModelValidationRequired { - -} +@Model( + validation = ValidationStrategy.REQUIRED, + adaptables = {Resource.class}) +public class ModelValidationRequired {} diff --git a/src/test/java/org/apache/sling/models/validation/impl/it/testing/ModelValidationIT.java b/src/test/java/org/apache/sling/models/validation/impl/it/testing/ModelValidationIT.java index 0644d53..7c77cd0 100644 --- a/src/test/java/org/apache/sling/models/validation/impl/it/testing/ModelValidationIT.java +++ b/src/test/java/org/apache/sling/models/validation/impl/it/testing/ModelValidationIT.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * 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. + * 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.apache.sling.models.validation.impl.it.testing; @@ -54,7 +56,8 @@ public class ModelValidationIT { private ResourceResolver resourceResolver = null; - private static final int MODEL_AVAILABLE_TIMEOUT_SECONDS = Integer.getInteger("ValidationServiceIT.ModelAvailabelTimeoutSeconds", 60); + private static final int MODEL_AVAILABLE_TIMEOUT_SECONDS = + Integer.getInteger("ValidationServiceIT.ModelAvailabelTimeoutSeconds", 60); @Before public void setUp() throws InterruptedException, LoginException { @@ -63,14 +66,16 @@ public class ModelValidationIT { long timeoutMs = System.currentTimeMillis() + MODEL_AVAILABLE_TIMEOUT_SECONDS * 1000l; // wait for the model to become available (internally relies on search, is therefore asynchronous) do { - validationModel = validationService.getValidationModel("validation/test/resourceType1", - "/validation/testing/fakeFolder1/resource", false); + validationModel = validationService.getValidationModel( + "validation/test/resourceType1", "/validation/testing/fakeFolder1/resource", false); if (validationModel == null) { Thread.sleep(500); } } while (validationModel == null && System.currentTimeMillis() < timeoutMs); - Assert.assertNotNull("Could not get validation model for resource type 'validation/test/resourceType1' within " - + MODEL_AVAILABLE_TIMEOUT_SECONDS + " seconds", validationModel); + Assert.assertNotNull( + "Could not get validation model for resource type 'validation/test/resourceType1' within " + + MODEL_AVAILABLE_TIMEOUT_SECONDS + " seconds", + validationModel); modelFactory = teleporter.getService(ModelFactory.class); resourceResolverFactory = teleporter.getService(ResourceResolverFactory.class); resourceResolver = resourceResolverFactory.getServiceResourceResolver(null); @@ -108,10 +113,12 @@ public class ModelValidationIT { @Test public void testModelWithoutRequiredValidationModel() { // create a valid resource - Resource contentResource = resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); + Resource contentResource = + resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); Assert.assertNotNull("Content resource must exist", contentResource); expectedEx.expect(ValidationException.class); - expectedEx.expectMessage("Could not find validation model for resource '/apps/sling/validation/content/contentWithNoValidationModel' with type 'test/resourceType1'"); + expectedEx.expectMessage( + "Could not find validation model for resource '/apps/sling/validation/content/contentWithNoValidationModel' with type 'test/resourceType1'"); // generate a model modelFactory.createModel(contentResource, ModelValidationRequired.class); } @@ -119,7 +126,8 @@ public class ModelValidationIT { @Test public void testModelWithoutOptionalValidationModel() { // create a valid resource - Resource contentResource = resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); + Resource contentResource = + resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); Assert.assertNotNull("Content resource must exist", contentResource); // generate a model ModelValidationOptional model = modelFactory.createModel(contentResource, ModelValidationOptional.class); @@ -129,7 +137,8 @@ public class ModelValidationIT { @Test public void testInvalidModelWithValidationDisabled() { // create a valid resource - Resource contentResource = resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); + Resource contentResource = + resourceResolver.getResource("/apps/sling/validation/content/contentWithNoValidationModel"); Assert.assertNotNull("Content resource must exist", contentResource); // generate a model ModelValidationDisabled model = modelFactory.createModel(contentResource, ModelValidationDisabled.class);
