This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch maven-plugin-testing-3.x
in repository https://gitbox.apache.org/repos/asf/maven-plugin-testing.git
The following commit(s) were added to refs/heads/maven-plugin-testing-3.x by
this push:
new 79a1f79 Remove unused ResolverExpressionEvaluatorStub in JUnit5
implementation
79a1f79 is described below
commit 79a1f792cf8e4961ce74ede0409c3fa6d3dca652
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Wed Oct 22 23:29:37 2025 +0200
Remove unused ResolverExpressionEvaluatorStub in JUnit5 implementation
added in f46bdbe48e08e4ae38b0797243ba773b6f259e40
---
.../testing/ResolverExpressionEvaluatorStub.java | 113 ---------------------
.../testing/ResolverExpressionEvaluatorStub.java | 1 -
2 files changed, 114 deletions(-)
diff --git
a/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/ResolverExpressionEvaluatorStub.java
b/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/ResolverExpressionEvaluatorStub.java
deleted file mode 100644
index e95d6f4..0000000
---
a/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/ResolverExpressionEvaluatorStub.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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
- *
- * 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.maven.api.plugin.testing;
-
-import java.io.File;
-
-import org.apache.maven.artifact.repository.MavenArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
-
-/**
- * Stub for {@link ExpressionEvaluator}
- *
- * @author jesse
- */
-public class ResolverExpressionEvaluatorStub implements ExpressionEvaluator {
- /** {@inheritDoc} */
- @Override
- public Object evaluate(String expr) throws ExpressionEvaluationException {
-
- Object value = null;
-
- if (expr == null) {
- return null;
- }
-
- String expression = stripTokens(expr);
-
- if (expression.equals(expr)) {
- int index = expr.indexOf("${");
- if (index >= 0) {
- int lastIndex = expr.indexOf("}", index);
- if (lastIndex >= 0) {
- String retVal = expr.substring(0, index);
-
- if (index > 0 && expr.charAt(index - 1) == '$') {
- retVal += expr.substring(index + 1, lastIndex + 1);
- } else {
- retVal += evaluate(expr.substring(index, lastIndex +
1));
- }
-
- retVal += evaluate(expr.substring(lastIndex + 1));
- return retVal;
- }
- }
-
- // Was not an expression
- if (expression.indexOf("$$") > -1) {
- return expression.replaceAll("\\$\\$", "\\$");
- }
- }
-
- if ("basedir".equals(expression) ||
"project.basedir".equals(expression)) {
- return MojoExtension.getBasedir();
- } else if (expression.startsWith("basedir") ||
expression.startsWith("project.basedir")) {
- int pathSeparator = expression.indexOf("/");
-
- if (pathSeparator > 0) {
- value = MojoExtension.getBasedir() +
expression.substring(pathSeparator);
- } else {
- System.out.println("Got expression '" + expression + "' that
was not recognised");
- }
- return value;
- } else if ("localRepository".equals(expression)) {
- File localRepo = new File(MojoExtension.getBasedir(),
"target/local-repo");
- return new MavenArtifactRepository(
- "localRepository",
- "file://" + localRepo.getAbsolutePath(),
- new DefaultRepositoryLayout(),
- null,
- null);
- } else {
- return expr;
- }
- }
-
- private String stripTokens(String expr) {
- if (expr.startsWith("${") && expr.indexOf("}") == expr.length() - 1) {
- expr = expr.substring(2, expr.length() - 1);
- }
-
- return expr;
- }
-
- /** {@inheritDoc} */
- @Override
- public File alignToBaseDirectory(File file) {
- if (file.getAbsolutePath().startsWith(MojoExtension.getBasedir())) {
- return file;
- } else if (file.isAbsolute()) {
- return file;
- } else {
- return new File(MojoExtension.getBasedir(), file.getPath());
- }
- }
-}
diff --git
a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
index 5001b75..76f1b45 100644
---
a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
+++
b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
@@ -31,7 +31,6 @@ import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
*
* @author jesse
* @deprecated This stub is for deprecated JUnit 4 style tests.
- * For JUnit Jupiter tests you have to use {@link
org.apache.maven.api.plugin.testing.ResolverExpressionEvaluatorStub}.
*/
@Deprecated
public class ResolverExpressionEvaluatorStub implements ExpressionEvaluator {