Skip to content

Commit

Permalink
WW-5283 Adjusts tests to use proper new based test case class
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Feb 18, 2023
1 parent d36c708 commit f81a070
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -56,7 +53,7 @@ protected void assertFieldError(Map<String, List<String>> fieldErrors, String fi

protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
XmlConfigurationProvider c = new StrutsXmlConfigurationProvider("struts.xml");
configurationManager.addContainerProvider(c);
configurationManager.reload();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/

package ${package}.example;

import com.opensymphony.xwork2.ActionProxy;
Expand Down
Original file line number Diff line number Diff line change
@@ -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:https://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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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:https://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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/*
* 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:https://www.apache.org/licenses/LICENSE-2.0
*
* http:https://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};

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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/*
* 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:https://www.apache.org/licenses/LICENSE-2.0
*
* http:https://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};

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();
Expand Down

0 comments on commit f81a070

Please sign in to comment.