This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5283-update-test in repository https://gitbox.apache.org/repos/asf/struts-archetypes.git
commit f81a070f39ebca757a8d3104301c548e5e4eddf0 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Sat Feb 18 16:44:05 2023 +0100 WW-5283 Adjusts tests to use proper new based test case class --- .../src/test/java/actions/IndexTest.java | 2 +- .../src/test/java/example/ConfigTest.java | 9 +++---- .../src/test/java/example/HelloWorldTest.java | 3 +-- .../src/test/java/example/LoginTest.java | 1 - .../src/test/java/actions/HelloActionTest.java | 20 ++++++++++++++- .../src/test/java/actions/IndexTest.java | 20 ++++++++++++++- .../src/test/java/HelloWorldActionTest.java | 30 +++++++++++----------- .../src/test/java/IndexActionTest.java | 30 +++++++++++----------- 8 files changed, 73 insertions(+), 42 deletions(-) diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java index dde937a..7625e3d 100644 --- a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java +++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java @@ -19,7 +19,7 @@ package ${package}.actions; import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.StrutsRestTestCase; +import org.apache.struts2.junit.StrutsRestTestCase; import org.junit.Test; import static org.junit.Assert.*; diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java index 137ebb1..a222597 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java @@ -16,21 +16,18 @@ * specific language governing permissions and limitations * under the License. */ - package ${package}.example; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.config.RuntimeConfiguration; import com.opensymphony.xwork2.config.entities.ActionConfig; import com.opensymphony.xwork2.config.entities.ResultConfig; -import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; -import org.apache.struts2.StrutsTestCase; +import org.apache.struts2.config.StrutsXmlConfigurationProvider; +import org.apache.struts2.junit.StrutsTestCase; import java.util.List; import java.util.Map; -import org.apache.struts2.StrutsTestCase; - public class ConfigTest extends StrutsTestCase { protected void assertSuccess(String result) { @@ -56,7 +53,7 @@ public class ConfigTest extends StrutsTestCase { protected void setUp() throws Exception { super.setUp(); - XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml"); + XmlConfigurationProvider c = new StrutsXmlConfigurationProvider("struts.xml"); configurationManager.addContainerProvider(c); configurationManager.reload(); } diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java index a5ca567..8866809 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java @@ -16,12 +16,11 @@ * specific language governing permissions and limitations * under the License. */ - package ${package}.example; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.StrutsTestCase; +import org.apache.struts2.junit.StrutsTestCase; public class HelloWorldTest extends StrutsTestCase { diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java index e2f2b2e..b38350c 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - package ${package}.example; import com.opensymphony.xwork2.ActionProxy; diff --git a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java index 60e94d2..e7ba94b 100644 --- a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java +++ b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java @@ -1,6 +1,24 @@ +/* + * 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 ${package}.actions; -import org.apache.struts2.StrutsTestCase; +import org.apache.struts2.junit.StrutsTestCase; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; diff --git a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java index 517062a..45ae035 100644 --- a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java +++ b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java @@ -1,7 +1,25 @@ +/* + * 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 ${package}.actions; import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.StrutsTestCase; +import org.apache.struts2.junit.StrutsTestCase; public class IndexTest extends StrutsTestCase { diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/HelloWorldActionTest.java b/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/HelloWorldActionTest.java index e3ee006..3d72c16 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/HelloWorldActionTest.java +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/HelloWorldActionTest.java @@ -1,17 +1,20 @@ /* - * Copyright 2006 The Apache Software Foundation. + * 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 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 ${package}; @@ -19,11 +22,8 @@ import junit.framework.TestCase; import com.opensymphony.xwork2.Action; -/** - * - */ public class HelloWorldActionTest extends TestCase { - + public void testHelloWorldAction() throws Exception { HelloWorldAction action = new HelloWorldAction(); String result = action.execute(); diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/IndexActionTest.java b/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/IndexActionTest.java index e9c56f8..7d26922 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/IndexActionTest.java +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/test/java/IndexActionTest.java @@ -1,17 +1,20 @@ /* - * Copyright 2006 The Apache Software Foundation. + * 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 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 ${package}; @@ -19,11 +22,8 @@ import junit.framework.TestCase; import com.opensymphony.xwork2.Action; -/** - * - */ public class IndexActionTest extends TestCase { - + public void testIndexAction() throws Exception { IndexAction action = new IndexAction(); String result = action.execute();