This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5462-mock-package-cleanup in repository https://gitbox.apache.org/repos/asf/struts.git
commit 112eff9f2941d7a858b1230c9901b8c2d7288ffa Author: Lukasz Lenart <[email protected]> AuthorDate: Thu Jul 23 17:00:02 2026 +0200 WW-5462 refactor(core): move mock package to test sources, drop unused MockContainer BREAKING CHANGE: org.apache.struts2.mock is no longer part of the published struts2-core jar. Downstream tests should use struts2-junit-plugin, Mockito, or a local copy of the needed mock. --- .../org/apache/struts2/mock/MockContainer.java | 64 ---------------------- .../main/java/org/apache/struts2/mock/package.html | 21 ------- .../apache/struts2/mock/MockActionInvocation.java | 0 .../org/apache/struts2/mock/MockActionProxy.java | 0 .../org/apache/struts2/mock/MockInterceptor.java | 0 .../struts2/mock/MockObjectTypeDeterminer.java | 0 .../java/org/apache/struts2/mock/MockResult.java | 0 7 files changed, 85 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/mock/MockContainer.java b/core/src/main/java/org/apache/struts2/mock/MockContainer.java deleted file mode 100644 index a03ec2d67..000000000 --- a/core/src/main/java/org/apache/struts2/mock/MockContainer.java +++ /dev/null @@ -1,64 +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.struts2.mock; - -import org.apache.struts2.inject.Container; -import org.apache.struts2.inject.Scope; - -import java.util.Set; - -/** - * Mock implementation to be used in unittests - */ -public class MockContainer implements Container { - - public void inject(Object o) { - - } - - public <T> T inject(Class<T> implementation) { - return null; - } - - public <T> T getInstance(Class<T> type, String name) { - return null; - } - - public <T> T getInstance(Class<T> type) { - return null; - } - - public Set<String> getInstanceNames(Class<?> type) { - return null; - } - - public void setScopeStrategy(Scope.Strategy scopeStrategy) { - - } - - public void removeScopeStrategy() { - - } - - @Override - public void destroy() { - // no-op in mock - } - -} diff --git a/core/src/main/java/org/apache/struts2/mock/package.html b/core/src/main/java/org/apache/struts2/mock/package.html deleted file mode 100644 index fafd91c66..000000000 --- a/core/src/main/java/org/apache/struts2/mock/package.html +++ /dev/null @@ -1,21 +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. - */ ---> -<body>XWork specific mock classes.</body> diff --git a/core/src/main/java/org/apache/struts2/mock/MockActionInvocation.java b/core/src/test/java/org/apache/struts2/mock/MockActionInvocation.java similarity index 100% rename from core/src/main/java/org/apache/struts2/mock/MockActionInvocation.java rename to core/src/test/java/org/apache/struts2/mock/MockActionInvocation.java diff --git a/core/src/main/java/org/apache/struts2/mock/MockActionProxy.java b/core/src/test/java/org/apache/struts2/mock/MockActionProxy.java similarity index 100% rename from core/src/main/java/org/apache/struts2/mock/MockActionProxy.java rename to core/src/test/java/org/apache/struts2/mock/MockActionProxy.java diff --git a/core/src/main/java/org/apache/struts2/mock/MockInterceptor.java b/core/src/test/java/org/apache/struts2/mock/MockInterceptor.java similarity index 100% rename from core/src/main/java/org/apache/struts2/mock/MockInterceptor.java rename to core/src/test/java/org/apache/struts2/mock/MockInterceptor.java diff --git a/core/src/main/java/org/apache/struts2/mock/MockObjectTypeDeterminer.java b/core/src/test/java/org/apache/struts2/mock/MockObjectTypeDeterminer.java similarity index 100% rename from core/src/main/java/org/apache/struts2/mock/MockObjectTypeDeterminer.java rename to core/src/test/java/org/apache/struts2/mock/MockObjectTypeDeterminer.java diff --git a/core/src/main/java/org/apache/struts2/mock/MockResult.java b/core/src/test/java/org/apache/struts2/mock/MockResult.java similarity index 100% rename from core/src/main/java/org/apache/struts2/mock/MockResult.java rename to core/src/test/java/org/apache/struts2/mock/MockResult.java
