+
+
+
diff --git a/seedProject/.classpath b/seedProject/.classpath
index f1fb698..f9b0575 100644
--- a/seedProject/.classpath
+++ b/seedProject/.classpath
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/seedProject/pom.xml b/seedProject/pom.xml
index ba51699..11d610c 100644
--- a/seedProject/pom.xml
+++ b/seedProject/pom.xml
@@ -1,73 +1,73 @@
-
- 4.0.0
- org.myorg.example
- xcore-testproject
- 0.1
- XCore Test Project
-
- src/main/java
-
-
- src/main/resources
-
- **/*.java
-
-
-
- config
-
- **/*.java
-
-
-
-
-
- maven-compiler-plugin
- 3.2
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-failsafe-plugin
- 2.17
-
-
- perform-it
- integration-test
-
- integration-test
-
-
-
- verify-it
- verify
-
- verify
-
-
-
- profiles/strategies/${jtaf.strategy}.strategy.xml
-
-
-
-
-
-
- **/XMLTestDriver*
-
- true
-
-
-
-
-
-
- org.finra.jtaf
- jtaf-core
- 1.0-SNAPSHOT
-
-
-
+
+ 4.0.0
+ org.myorg.example
+ xcore-testproject
+ 0.1
+ XCore Test Project
+
+ src/main/java
+
+
+ src/main/resources
+
+ **/*.java
+
+
+
+ config
+
+ **/*.java
+
+
+
+
+
+ maven-compiler-plugin
+ 3.2
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.17
+
+
+ perform-it
+ integration-test
+
+ integration-test
+
+
+
+ verify-it
+ verify
+
+ verify
+
+
+
+ profiles/strategies/${jtaf.strategy}.strategy.xml
+
+
+
+
+
+
+ **/XMLTestDriver*
+
+ true
+
+
+
+
+
+
+ org.finra.jtaf
+ jtaf-core
+ 1.0-SNAPSHOT
+
+
+
diff --git a/seedProject/src/main/java/org/myorg/example/commands/helloworld/ExampleCommand.java b/seedProject/src/main/java/org/myorg/example/commands/helloworld/ExampleCommand.java
index 68e7c10..c0cb077 100644
--- a/seedProject/src/main/java/org/myorg/example/commands/helloworld/ExampleCommand.java
+++ b/seedProject/src/main/java/org/myorg/example/commands/helloworld/ExampleCommand.java
@@ -1,36 +1,36 @@
-package org.myorg.example.commands.helloworld;
-
-import java.util.Map;
-
-import org.finra.jtaf.core.model.exceptions.NameFormatException;
-import org.finra.jtaf.core.model.execution.IInvocationContext;
-import org.finra.jtaf.core.model.invocationtarget.Command;
-import org.junit.Assert;
-
-public class ExampleCommand extends Command {
-
- public ExampleCommand(String name) throws NameFormatException {
- super(name);
- }
-
- protected void execute(IInvocationContext ctx) throws Throwable {
- String expectedText="Hello world";
- String actualText=getRequiredString("assertableText");
-
- Assert.assertEquals("Your text doesn't match " + expectedText, expectedText, actualText);
-
- @SuppressWarnings("unchecked")
- Map map = (Map) getOptionalObject("mapToPrint");
-
- if(map != null) {
- for(String k : map.keySet()) {
- System.out.println(k + ": " + map.get(k));
- }
- }
-
- boolean printHello = getBooleanOrDefault("printHello", false);
- if(printHello) {
- System.out.println("Hello.");
- }
- }
+package org.myorg.example.commands.helloworld;
+
+import java.util.Map;
+
+import org.finra.jtaf.core.model.exceptions.NameFormatException;
+import org.finra.jtaf.core.model.execution.IInvocationContext;
+import org.finra.jtaf.core.model.invocationtarget.Command;
+import org.junit.Assert;
+
+public class ExampleCommand extends Command {
+
+ public ExampleCommand(String name) throws NameFormatException {
+ super(name);
+ }
+
+ protected void execute(IInvocationContext ctx) throws Throwable {
+ String expectedText="Hello world";
+ String actualText=getRequiredString("assertableText");
+
+ Assert.assertEquals("Your text doesn't match " + expectedText, expectedText, actualText);
+
+ @SuppressWarnings("unchecked")
+ Map map = (Map) getOptionalObject("mapToPrint");
+
+ if(map != null) {
+ for(String k : map.keySet()) {
+ System.out.println(k + ": " + map.get(k));
+ }
+ }
+
+ boolean printHello = getBooleanOrDefault("printHello", false);
+ if(printHello) {
+ System.out.println("Hello.");
+ }
+ }
}
\ No newline at end of file
diff --git a/seedProject/src/main/resources/framework.xml b/seedProject/src/main/resources/framework.xml
index b2036fc..eba6046 100644
--- a/seedProject/src/main/resources/framework.xml
+++ b/seedProject/src/main/resources/framework.xml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/seedProject/src/main/resources/jtaf.properties b/seedProject/src/main/resources/jtaf.properties
index 94f4333..a47bda6 100644
--- a/seedProject/src/main/resources/jtaf.properties
+++ b/seedProject/src/main/resources/jtaf.properties
@@ -1,3 +1,3 @@
-strategy=profiles/strategies/helloworld.strategy.xml
-
-
+strategy=profiles/strategies/helloworld.strategy.xml
+
+
diff --git a/src/main/java/org/finra/jtaf/core/AutomationEngine.java b/src/main/java/org/finra/jtaf/core/AutomationEngine.java
index c910437..1986745 100644
--- a/src/main/java/org/finra/jtaf/core/AutomationEngine.java
+++ b/src/main/java/org/finra/jtaf/core/AutomationEngine.java
@@ -61,293 +61,299 @@
* components. All of its subcomponents are instantiated from a Spring factory.
*/
public class AutomationEngine {
- private static AutomationEngine s_instance;
-
- public static final Logger logger = Logger
- .getLogger(AutomationEngine.class);
- public MessageCollector mc = new MessageCollector("Building model");
- private static final String FRAMEWORK_XML = "framework.xml";
-
- // FIXME: Rewrite this parser
- private final ScriptParser scriptParser;
- private final CommandLibraryParser commandlibParser;
-
- // FIXME: And rewrite this one while you're at it :-D
- private final TestStrategyParser testStrategyParser;
-
- private TestNamespace testRoot;
- private Interpreter interpreter;
- private PluginManager pluginManager;
- private TestAgenda testAgenda;
- private CommandRegistry commandRegistry;
-
- private TestDigraph digraph;
-
- private List postParseAllPlugins;
-
- private AutomationEngine() {
- try {
- InputStream fi = getFrameworkFile();
- GenericApplicationContext ctx = new GenericApplicationContext();
-
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
- xmlReader
- .setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
-
- xmlReader.loadBeanDefinitions(new InputSource(fi));
-
- ctx.refresh();
-
- this.pluginManager = (PluginManager) ctx.getBean("PluginManager");
-
- digraph = new TestDigraph(
- new ClassBasedEdgeFactory(DiEdge.class));
- commandlibParser = new CommandLibraryParser();
- scriptParser = new ScriptParser();
- scriptParser.setDigraph(digraph);
- commandlibParser
- .setAutomationClassLoader(new DefaultAutomationClassLoader());
- testStrategyParser = new TestStrategyParser();
- testStrategyParser.setDigraph(digraph);
- initPostParseStrategyElementPlugins();
- testRoot = null;
-
- this.interpreter = (Interpreter) ctx.getBean("Interpreter");
-
- this.interpreter.setCommandRunnerPlugins(pluginManager
- .getCommandRunnerPlugins());
- this.interpreter.setTestRunnerPlugins(pluginManager
- .getTestRunnerPlugins());
- this.interpreter.setTearDownPlugins(pluginManager.getTearDownPlugins());
-
- initPostParseAllPlugins();
- initPostParseSuitePlugins();
- initPostParseTestPlugins();
-
- } catch (Exception e) {
- // If something goes wrong here, we have a serious issue
- logger.fatal(e);
- throw new RuntimeException(e);
- }
- }
-
- private void initPostParseStrategyElementPlugins() {
- List postParseStrategyElementPlugins = new ArrayList();
- postParseStrategyElementPlugins.add(new AutomationValuePlugin());
- postParseStrategyElementPlugins.add(new MaxThreadsPlugin());
- List postParseStrategyElementPluginsFromManager = pluginManager
- .getPostParseStrategyElementPlugins();
- if (postParseStrategyElementPluginsFromManager != null) {
- postParseStrategyElementPlugins
- .addAll(postParseStrategyElementPluginsFromManager);
- }
- testStrategyParser
- .setPostParseStrategyElementPlugins(postParseStrategyElementPlugins);
- }
-
- private void initPostParseAllPlugins() {
- postParseAllPlugins = new ArrayList();
- postParseAllPlugins.add(new DigraphPlugin());
- postParseAllPlugins.add(new TraceabilityMatrixPlugin());
- List postParseAllPluginsFromManager = pluginManager
- .getPostParseAllPlugins();
- if (postParseAllPluginsFromManager != null) {
- postParseAllPlugins.addAll(postParseAllPluginsFromManager);
- }
- postParseAllPlugins.add(new AutomationValueFilterPlugin());
- }
-
- private void initPostParseSuitePlugins() {
- List postParseSuitePlugins = new ArrayList();
- postParseSuitePlugins.add(new SuiteDependenciesPlugin());
- postParseSuitePlugins.add(new SuiteExclusionsPlugin());
- List postParseSuitePluginsFromManager = pluginManager
- .getPostParseSuitePlugins();
- if (postParseSuitePluginsFromManager != null) {
- postParseSuitePlugins.addAll(postParseSuitePluginsFromManager);
- }
- scriptParser.setPostParseSuitePlugins(postParseSuitePlugins);
- }
-
- private void initPostParseTestPlugins() {
- List postParseTestPlugins = new ArrayList();
- postParseTestPlugins.add(new ExceptionPlugin());
- List postParseTestPluginsFromManager = pluginManager
- .getPostParseTestPlugins();
- if (postParseTestPluginsFromManager != null) {
- postParseTestPlugins.addAll(postParseTestPluginsFromManager);
- }
- scriptParser.setPostParseTestPlugins(postParseTestPlugins);
-
- List postParseSuitePlugins = new ArrayList();
- postParseSuitePlugins.add(new SuiteDependenciesPlugin());
- postParseSuitePlugins.add(new SuiteExclusionsPlugin());
- List postParseSuitePluginsFromManager = pluginManager
- .getPostParseSuitePlugins();
- if (postParseSuitePluginsFromManager != null) {
- postParseSuitePlugins.addAll(postParseSuitePluginsFromManager);
- }
- scriptParser.setPostParseSuitePlugins(postParseSuitePlugins);
- }
-
- private static InputStream getFrameworkFile() {
- InputStream is = AutomationEngine.class.getClassLoader()
- .getResourceAsStream(FRAMEWORK_XML);
- try {
- if (is == null) {
- is = new FileInputStream(new File(FRAMEWORK_XML));
- }
-
- } catch (IOException e) {
- throw new RuntimeException("Could not load :" + FRAMEWORK_XML, e);
- }
- return is;
- }
-
- /**
- * Singleton accessor method.
- *
- * @return
- */
- public static final AutomationEngine getInstance() {
- if (AutomationEngine.s_instance == null) {
- AutomationEngine.s_instance = new AutomationEngine();
- }
- return AutomationEngine.s_instance;
- }
-
- /**
- * Gets the test root.
- *
- * @return
- */
- public final TestNamespace getTestRoot() {
- return testRoot;
- }
-
- /**
- * Builds test model from the specified test library folder and test scripts
- * folder. By default it would also load the test libraries from the
- * classpath. The test libraries are assumed to have extension
- * *.commands.xml and expected to be under testlibrary folder/package
- *
- * @param librarySource
- * @param testSource
- */
- public final void buildModel(File librarySource, File testSource) {
- System.out.println("Building model...");
- logger.info("Building model...");
-
- boolean isFailed = false;
-
- try {
- commandRegistry = new CommandRegistry();
- commandlibParser.parseCommandLibraries(commandRegistry,
- librarySource, mc);
-
- } catch (Exception e) {
- mc.error(e.getMessage());
- e.printStackTrace();
- isFailed = true;
- }
-
-
- interpreter.setCommandRegistry(commandRegistry);
- scriptParser.setCommandRegistry(commandRegistry);
- try {
- testRoot = scriptParser.handleTestSource(testSource, mc);
-
- // build agenda
- String fileLocation = JTAFPropertyManager.getInstance()
- .getProperty("strategy");
- buildTestAgenda(new File(fileLocation));
- // run post all parsing plugins
-
- if (postParseAllPlugins != null) {
- for (IPostParseAllPlugin p : postParseAllPlugins) {
- p.execute(new PostAllParserPluginContext(testAgenda,
- commandRegistry));
- }
- }
- } catch (Exception e) {
- mc.error(e.getMessage());
- logger.error(e.getMessage());
- isFailed = true;
- }
-
- if (isFailed) {
- mc.dump(logger);
- logger.fatal("Failed to build test model. See logs for details");
- throw new RuntimeException(
- "Failed to build test model. See logs for details");
- }
-
- logger.info("Building model... Done");
- System.out.println("Building model... Done");
-
- }
-
- private TestAgenda buildTestAgenda(File file) throws ParsingException,
- SAXException, IOException {
- // System.out.println("Building test agenda...");
- logger.info("Building test agenda...");
- testStrategyParser.parse(file);
- // TODO: add step to connect parsed object to test objects and
- // dependency graph
- testStrategyParser.getErrorCollector().dump(logger);
- testAgenda = testStrategyParser.getTestPlan();
- logger.info("Building test agenda... Done.");
- return testAgenda;
- }
-
- /**
- * Gets the test agenda or the strategy object.
- * @return
- */
- public TestAgenda getTestAgenda() {
- return testAgenda;
- }
-
- /**
- * Gets the test interpreter.
- * @return
- */
- public final Interpreter getInterpreter() {
-
- return interpreter;
- }
-
- /**
- * Gets the plugin manager
- * @return
- */
- public PluginManager getPluginManager() {
- return pluginManager;
- }
-
- /**
- * Gets the digraph of tests.
- * @return
- */
- public final TestDigraph getTestDigraph() {
- return digraph;
- }
-
- /**
- * Gets the command registry
- * @return
- */
- public CommandRegistry getCommandRegistry() {
- return commandRegistry;
- }
-
-
- /**
- * Gets the script parser.
- * @return
- */
- public ScriptParser getScriptParser() {
- return scriptParser;
- }
+ private static AutomationEngine s_instance;
+
+ public static final Logger logger = Logger
+ .getLogger(AutomationEngine.class);
+ public MessageCollector mc = new MessageCollector("Building model");
+ private static final String FRAMEWORK_XML = "framework.xml";
+
+ // FIXME: Rewrite this parser
+ private final ScriptParser scriptParser;
+ private final CommandLibraryParser commandlibParser;
+
+ // FIXME: And rewrite this one while you're at it :-D
+ private final TestStrategyParser testStrategyParser;
+
+ private TestNamespace testRoot;
+ private Interpreter interpreter;
+ private PluginManager pluginManager;
+ private TestAgenda testAgenda;
+ private CommandRegistry commandRegistry;
+
+ private TestDigraph digraph;
+
+ private List postParseAllPlugins;
+
+ private AutomationEngine() {
+ try {
+ InputStream fi = getFrameworkFile();
+ GenericApplicationContext ctx = new GenericApplicationContext();
+
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
+ xmlReader
+ .setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
+
+ xmlReader.loadBeanDefinitions(new InputSource(fi));
+
+ ctx.refresh();
+
+ this.pluginManager = (PluginManager) ctx.getBean("PluginManager");
+
+ digraph = new TestDigraph(
+ new ClassBasedEdgeFactory(DiEdge.class));
+ commandlibParser = new CommandLibraryParser();
+ scriptParser = new ScriptParser();
+ scriptParser.setDigraph(digraph);
+ commandlibParser
+ .setAutomationClassLoader(new DefaultAutomationClassLoader());
+ testStrategyParser = new TestStrategyParser();
+ testStrategyParser.setDigraph(digraph);
+ initPostParseStrategyElementPlugins();
+ testRoot = null;
+
+ this.interpreter = (Interpreter) ctx.getBean("Interpreter");
+
+ this.interpreter.setCommandRunnerPlugins(pluginManager
+ .getCommandRunnerPlugins());
+ this.interpreter.setTestRunnerPlugins(pluginManager
+ .getTestRunnerPlugins());
+ this.interpreter.setTearDownPlugins(pluginManager.getTearDownPlugins());
+
+ initPostParseAllPlugins();
+ initPostParseSuitePlugins();
+ initPostParseTestPlugins();
+
+ } catch (Exception e) {
+ // If something goes wrong here, we have a serious issue
+ logger.fatal(e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void initPostParseStrategyElementPlugins() {
+ List postParseStrategyElementPlugins = new ArrayList();
+ postParseStrategyElementPlugins.add(new AutomationValuePlugin());
+ postParseStrategyElementPlugins.add(new MaxThreadsPlugin());
+ List postParseStrategyElementPluginsFromManager = pluginManager
+ .getPostParseStrategyElementPlugins();
+ if (postParseStrategyElementPluginsFromManager != null) {
+ postParseStrategyElementPlugins
+ .addAll(postParseStrategyElementPluginsFromManager);
+ }
+ testStrategyParser
+ .setPostParseStrategyElementPlugins(postParseStrategyElementPlugins);
+ }
+
+ private void initPostParseAllPlugins() {
+ postParseAllPlugins = new ArrayList();
+ postParseAllPlugins.add(new DigraphPlugin());
+ postParseAllPlugins.add(new TraceabilityMatrixPlugin());
+ List postParseAllPluginsFromManager = pluginManager
+ .getPostParseAllPlugins();
+ if (postParseAllPluginsFromManager != null) {
+ postParseAllPlugins.addAll(postParseAllPluginsFromManager);
+ }
+ postParseAllPlugins.add(new AutomationValueFilterPlugin());
+ }
+
+ private void initPostParseSuitePlugins() {
+ List postParseSuitePlugins = new ArrayList();
+ postParseSuitePlugins.add(new SuiteDependenciesPlugin());
+ postParseSuitePlugins.add(new SuiteExclusionsPlugin());
+ List postParseSuitePluginsFromManager = pluginManager
+ .getPostParseSuitePlugins();
+ if (postParseSuitePluginsFromManager != null) {
+ postParseSuitePlugins.addAll(postParseSuitePluginsFromManager);
+ }
+ scriptParser.setPostParseSuitePlugins(postParseSuitePlugins);
+ }
+
+ private void initPostParseTestPlugins() {
+ List postParseTestPlugins = new ArrayList();
+ postParseTestPlugins.add(new ExceptionPlugin());
+ List postParseTestPluginsFromManager = pluginManager
+ .getPostParseTestPlugins();
+ if (postParseTestPluginsFromManager != null) {
+ postParseTestPlugins.addAll(postParseTestPluginsFromManager);
+ }
+ scriptParser.setPostParseTestPlugins(postParseTestPlugins);
+
+ List postParseSuitePlugins = new ArrayList();
+ postParseSuitePlugins.add(new SuiteDependenciesPlugin());
+ postParseSuitePlugins.add(new SuiteExclusionsPlugin());
+ List postParseSuitePluginsFromManager = pluginManager
+ .getPostParseSuitePlugins();
+ if (postParseSuitePluginsFromManager != null) {
+ postParseSuitePlugins.addAll(postParseSuitePluginsFromManager);
+ }
+ scriptParser.setPostParseSuitePlugins(postParseSuitePlugins);
+ }
+
+ private static InputStream getFrameworkFile() {
+ InputStream is = AutomationEngine.class.getClassLoader()
+ .getResourceAsStream(FRAMEWORK_XML);
+ try {
+ if (is == null) {
+ is = new FileInputStream(new File(FRAMEWORK_XML));
+ }
+
+ } catch (IOException e) {
+ throw new RuntimeException("Could not load :" + FRAMEWORK_XML, e);
+ }
+ return is;
+ }
+
+ /**
+ * Singleton accessor method.
+ *
+ * @return
+ */
+ public static final AutomationEngine getInstance() {
+ if (AutomationEngine.s_instance == null) {
+ AutomationEngine.s_instance = new AutomationEngine();
+ }
+ return AutomationEngine.s_instance;
+ }
+
+ /**
+ * Gets the test root.
+ *
+ * @return
+ */
+ public final TestNamespace getTestRoot() {
+ return testRoot;
+ }
+
+ /**
+ * Builds test model from the specified test library folder and test scripts
+ * folder. By default it would also load the test libraries from the
+ * classpath. The test libraries are assumed to have extension
+ * *.commands.xml and expected to be under testlibrary folder/package
+ *
+ * @param librarySource
+ * @param testSource
+ */
+ public final void buildModel(File librarySource, File testSource) {
+ System.out.println("Building model...");
+ logger.info("Building model...");
+
+ boolean isFailed = false;
+
+ try {
+ commandRegistry = new CommandRegistry();
+ commandlibParser.parseCommandLibraries(commandRegistry,
+ librarySource, mc);
+
+ } catch (Exception e) {
+ mc.error(e.getMessage());
+ e.printStackTrace();
+ isFailed = true;
+ }
+
+
+ interpreter.setCommandRegistry(commandRegistry);
+ scriptParser.setCommandRegistry(commandRegistry);
+ try {
+ testRoot = scriptParser.handleTestSource(testSource, mc);
+
+ // build agenda
+ String fileLocation = JTAFPropertyManager.getInstance()
+ .getProperty("strategy");
+ buildTestAgenda(new File(fileLocation));
+ // run post all parsing plugins
+
+ if (postParseAllPlugins != null) {
+ for (IPostParseAllPlugin p : postParseAllPlugins) {
+ p.execute(new PostAllParserPluginContext(testAgenda,
+ commandRegistry));
+ }
+ }
+ } catch (Exception e) {
+ mc.error(e.getMessage());
+ logger.error(e.getMessage());
+ isFailed = true;
+ }
+
+ if (isFailed) {
+ mc.dump(logger);
+ logger.fatal("Failed to build test model. See logs for details");
+ throw new RuntimeException(
+ "Failed to build test model. See logs for details");
+ }
+
+ logger.info("Building model... Done");
+ System.out.println("Building model... Done");
+
+ }
+
+ private TestAgenda buildTestAgenda(File file) throws ParsingException,
+ SAXException, IOException {
+ // System.out.println("Building test agenda...");
+ logger.info("Building test agenda...");
+ testStrategyParser.parse(file);
+ // TODO: add step to connect parsed object to test objects and
+ // dependency graph
+ testStrategyParser.getErrorCollector().dump(logger);
+ testAgenda = testStrategyParser.getTestPlan();
+ logger.info("Building test agenda... Done.");
+ return testAgenda;
+ }
+
+ /**
+ * Gets the test agenda or the strategy object.
+ *
+ * @return
+ */
+ public TestAgenda getTestAgenda() {
+ return testAgenda;
+ }
+
+ /**
+ * Gets the test interpreter.
+ *
+ * @return
+ */
+ public final Interpreter getInterpreter() {
+
+ return interpreter;
+ }
+
+ /**
+ * Gets the plugin manager
+ *
+ * @return
+ */
+ public PluginManager getPluginManager() {
+ return pluginManager;
+ }
+
+ /**
+ * Gets the digraph of tests.
+ *
+ * @return
+ */
+ public final TestDigraph getTestDigraph() {
+ return digraph;
+ }
+
+ /**
+ * Gets the command registry
+ *
+ * @return
+ */
+ public CommandRegistry getCommandRegistry() {
+ return commandRegistry;
+ }
+
+
+ /**
+ * Gets the script parser.
+ *
+ * @return
+ */
+ public ScriptParser getScriptParser() {
+ return scriptParser;
+ }
}
diff --git a/src/main/java/org/finra/jtaf/core/CommandRegistry.java b/src/main/java/org/finra/jtaf/core/CommandRegistry.java
index ca0a852..91a8d59 100644
--- a/src/main/java/org/finra/jtaf/core/CommandRegistry.java
+++ b/src/main/java/org/finra/jtaf/core/CommandRegistry.java
@@ -1,66 +1,67 @@
-/*
- * (C) Copyright 2014 Java Test Automation Framework Contributors.
- *
- * 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
- *
- * 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.finra.jtaf.core;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.finra.jtaf.core.model.invocationtarget.InvocationTarget;
-
-/**
- * This class is for the commands registered in the *.commands.xml files in
- * testlibrary folder. It is a property of the Automation Engine. It saves
- * pair for each command.
- *
- */
-public class CommandRegistry {
- private final Map invocationTargetMap;
-
- public CommandRegistry() {
- this.invocationTargetMap = new HashMap();
- }
-
-
-
- /**
- * Registers the specified command/invocation target.
- * @param name
- * @param invocationTarget
- */
- public void registerInvocationTarget(String name, InvocationTarget invocationTarget){
- this.invocationTargetMap.put(name, invocationTarget);
- }
-
- /**
- * Returns true if the invocation target is present
- * @param name
- * @return
- */
- public final boolean containsInvocationTarget(String name) {
- return invocationTargetMap.containsKey(name.toLowerCase());
- }
-
- /**
- * Gets the specified invocation target
- * @param name
- * @return
- */
- public final InvocationTarget getInvocationTarget(String name) {
- return invocationTargetMap.get(name.toLowerCase());
- }
-
-}
+/*
+ * (C) Copyright 2014 Java Test Automation Framework Contributors.
+ *
+ * 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
+ *
+ * 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.finra.jtaf.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.finra.jtaf.core.model.invocationtarget.InvocationTarget;
+
+/**
+ * This class is for the commands registered in the *.commands.xml files in
+ * testlibrary folder. It is a property of the Automation Engine. It saves
+ * pair for each command.
+ */
+public class CommandRegistry {
+ private final Map invocationTargetMap;
+
+ public CommandRegistry() {
+ this.invocationTargetMap = new HashMap();
+ }
+
+
+ /**
+ * Registers the specified command/invocation target.
+ *
+ * @param name
+ * @param invocationTarget
+ */
+ public void registerInvocationTarget(String name, InvocationTarget invocationTarget) {
+ this.invocationTargetMap.put(name, invocationTarget);
+ }
+
+ /**
+ * Returns true if the invocation target is present
+ *
+ * @param name
+ * @return
+ */
+ public final boolean containsInvocationTarget(String name) {
+ return invocationTargetMap.containsKey(name.toLowerCase());
+ }
+
+ /**
+ * Gets the specified invocation target
+ *
+ * @param name
+ * @return
+ */
+ public final InvocationTarget getInvocationTarget(String name) {
+ return invocationTargetMap.get(name.toLowerCase());
+ }
+
+}
diff --git a/src/main/java/org/finra/jtaf/core/DefaultAutomationClassLoader.java b/src/main/java/org/finra/jtaf/core/DefaultAutomationClassLoader.java
index c6a725d..d118bb8 100644
--- a/src/main/java/org/finra/jtaf/core/DefaultAutomationClassLoader.java
+++ b/src/main/java/org/finra/jtaf/core/DefaultAutomationClassLoader.java
@@ -19,25 +19,22 @@
/**
* Implementation of the {@link IAutomationClassLoader}
- *
*/
-public class DefaultAutomationClassLoader implements IAutomationClassLoader{
+public class DefaultAutomationClassLoader implements IAutomationClassLoader {
+
+ /* (non-Javadoc)
+ * @see org.finra.jtaf.core.IAutomationClassLoader#loadClass(java.lang.String)
+ */
+ @Override
+ public Class> loadClass(String commandClass) throws ClassNotFoundException {
- /* (non-Javadoc)
- * @see org.finra.jtaf.core.IAutomationClassLoader#loadClass(java.lang.String)
- */
- @Override
- public Class> loadClass(String commandClass) throws ClassNotFoundException {
-
- try{
- return Class.forName(commandClass);
- }
- catch(ClassNotFoundException e){
- throw new ClassNotFoundException("Unable to Load command class " + commandClass, e);
- }
- catch(NoClassDefFoundError e1){
- throw new NoClassDefFoundError("Unable to Load command class " + commandClass + "Exception "+ e1);
- }
- }
+ try {
+ return Class.forName(commandClass);
+ } catch (ClassNotFoundException e) {
+ throw new ClassNotFoundException("Unable to Load command class " + commandClass, e);
+ } catch (NoClassDefFoundError e1) {
+ throw new NoClassDefFoundError("Unable to Load command class " + commandClass + "Exception " + e1);
+ }
+ }
}
diff --git a/src/main/java/org/finra/jtaf/core/IAutomationClassLoader.java b/src/main/java/org/finra/jtaf/core/IAutomationClassLoader.java
index 2dceec6..704fa6e 100644
--- a/src/main/java/org/finra/jtaf/core/IAutomationClassLoader.java
+++ b/src/main/java/org/finra/jtaf/core/IAutomationClassLoader.java
@@ -21,13 +21,13 @@
*/
public interface IAutomationClassLoader {
- /**
- * Returns the class object associated with the given classname
- * @param commandClass
- * => The class the object of which is needed
- * @return
- * @throws ClassNotFoundException
- */
- Class> loadClass(String commandClass) throws ClassNotFoundException;
+ /**
+ * Returns the class object associated with the given classname
+ *
+ * @param commandClass => The class the object of which is needed
+ * @return
+ * @throws ClassNotFoundException
+ */
+ Class> loadClass(String commandClass) throws ClassNotFoundException;
}
diff --git a/src/main/java/org/finra/jtaf/core/asserts/AssertionFailedError.java b/src/main/java/org/finra/jtaf/core/asserts/AssertionFailedError.java
index bfacf1a..4754d6b 100644
--- a/src/main/java/org/finra/jtaf/core/asserts/AssertionFailedError.java
+++ b/src/main/java/org/finra/jtaf/core/asserts/AssertionFailedError.java
@@ -1,36 +1,36 @@
-/*
- * (C) Copyright 2014 Java Test Automation Framework Contributors.
- *
- * 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
- *
- * 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.finra.jtaf.core.asserts;
-
-/**
- * Thrown when an assertion failed.
- */
-public class AssertionFailedError extends AssertionError {
-
- private static final long serialVersionUID= 1L;
-
- public AssertionFailedError() {
- }
-
- public AssertionFailedError(String message) {
- super(defaultString(message));
- }
-
- private static String defaultString(String message) {
- return message == null ? "" : message;
- }
+/*
+ * (C) Copyright 2014 Java Test Automation Framework Contributors.
+ *
+ * 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
+ *
+ * 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.finra.jtaf.core.asserts;
+
+/**
+ * Thrown when an assertion failed.
+ */
+public class AssertionFailedError extends AssertionError {
+
+ private static final long serialVersionUID = 1L;
+
+ public AssertionFailedError() {
+ }
+
+ public AssertionFailedError(String message) {
+ super(defaultString(message));
+ }
+
+ private static String defaultString(String message) {
+ return message == null ? "" : message;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/finra/jtaf/core/asserts/ErrorAccumulator.java b/src/main/java/org/finra/jtaf/core/asserts/ErrorAccumulator.java
index 129cfdb..8d5cd7a 100644
--- a/src/main/java/org/finra/jtaf/core/asserts/ErrorAccumulator.java
+++ b/src/main/java/org/finra/jtaf/core/asserts/ErrorAccumulator.java
@@ -1,159 +1,164 @@
-/*
- * (C) Copyright 2014 Java Test Automation Framework Contributors.
- *
- * 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
- *
- * 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.finra.jtaf.core.asserts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.exception.ExceptionUtils;
-
-/**
- *
- * This class can be used to collect errors.
- *
- */
-public class ErrorAccumulator {
-
- private String name;
- private ArrayList errors;
-
- // needed for ignore errors at script level:
- boolean errorsThrown = false;
-
- /**
- * Create a named error accumulator
- * @param name
- */
- public ErrorAccumulator(String name) {
- this.name = name;
- errors = new ArrayList();
- }
-
-
-
- /**
- * Gets the name of the accumulator
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the number of errors.
- * @return
- */
- public int getNumErrors() {
- return errors.size();
- }
-
- /**
- * Adds and Error to accumulate
- * @param th
- * @return
- */
- public boolean addError(Throwable th) {
- return errors.add(th);
- }
-
- /**
- * returns true if no errors
- * @return
- */
- public boolean isEmpty() {
- return errors.isEmpty();
- }
-
- /**
- * Returns error messages
- * @return
- */
- public String getErrorMessages() {
- String errorInfo = "";
-
- for (int i = 0; i < errors.size(); i++) {
- errorInfo = errorInfo + "\n " + errors.get(i).getLocalizedMessage();
- }
-
- return errorInfo;
- }
-
- /**
- * Returns error stack traces
- * @return
- */
- public String getErrorStackTraces() {
- String errorInfo = "";
- // TODO: use static access
- // TODO: determine if this dependency is really necessary, do we need to
- // depend on commons-lang to make stack trace printing easier?
- for (int i = 0; i < errors.size(); i++) {
- errorInfo = errorInfo + "\n " + ExceptionUtils.getStackTrace(errors.get(i));
- }
-
- return errorInfo;
- }
-
- /**
- * Returns list of stack trace elements
- * @return
- */
- public List getErrorStackTraceElementsList() {
- List list = new ArrayList();
- ArrayList errors = getErrors();
- for (Throwable th : errors) {
- list.add(th.getStackTrace());
- }
-
- return list;
- }
-
- /**
- * Throws accumulated errors
- */
- public void throwErrors() {
- AssertionFailedError e = getWrappedErrors();
- if (e != null) {
- errorsThrown = true;
- throw e;
- }
- }
-
- public boolean hasThrown() {
- return errorsThrown;
- }
-
- public ArrayList getErrors() {
- return errors;
- }
-
- public AssertionFailedError getWrappedErrors() {
-
- if (isEmpty())
- return null;
-
- String message = getErrorStackTraces();
-
- if (message.equals(""))
- return null;
-
- return new AssertionFailedError(
- "Error accumulator found and ignored the following errors in "
- + getName() + ":" + message);
-
- }
-}
+/*
+ * (C) Copyright 2014 Java Test Automation Framework Contributors.
+ *
+ * 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
+ *
+ * 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.finra.jtaf.core.asserts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+
+/**
+ * This class can be used to collect errors.
+ */
+public class ErrorAccumulator {
+
+ private String name;
+ private ArrayList errors;
+
+ // needed for ignore errors at script level:
+ boolean errorsThrown = false;
+
+ /**
+ * Create a named error accumulator
+ *
+ * @param name
+ */
+ public ErrorAccumulator(String name) {
+ this.name = name;
+ errors = new ArrayList();
+ }
+
+
+ /**
+ * Gets the name of the accumulator
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the number of errors.
+ *
+ * @return
+ */
+ public int getNumErrors() {
+ return errors.size();
+ }
+
+ /**
+ * Adds and Error to accumulate
+ *
+ * @param th
+ * @return
+ */
+ public boolean addError(Throwable th) {
+ return errors.add(th);
+ }
+
+ /**
+ * returns true if no errors
+ *
+ * @return
+ */
+ public boolean isEmpty() {
+ return errors.isEmpty();
+ }
+
+ /**
+ * Returns error messages
+ *
+ * @return
+ */
+ public String getErrorMessages() {
+ String errorInfo = "";
+
+ for (int i = 0; i < errors.size(); i++) {
+ errorInfo = errorInfo + "\n " + errors.get(i).getLocalizedMessage();
+ }
+
+ return errorInfo;
+ }
+
+ /**
+ * Returns error stack traces
+ *
+ * @return
+ */
+ public String getErrorStackTraces() {
+ String errorInfo = "";
+ // TODO: use static access
+ // TODO: determine if this dependency is really necessary, do we need to
+ // depend on commons-lang to make stack trace printing easier?
+ for (int i = 0; i < errors.size(); i++) {
+ errorInfo = errorInfo + "\n " + ExceptionUtils.getStackTrace(errors.get(i));
+ }
+
+ return errorInfo;
+ }
+
+ /**
+ * Returns list of stack trace elements
+ *
+ * @return
+ */
+ public List getErrorStackTraceElementsList() {
+ List list = new ArrayList();
+ ArrayList errors = getErrors();
+ for (Throwable th : errors) {
+ list.add(th.getStackTrace());
+ }
+
+ return list;
+ }
+
+ /**
+ * Throws accumulated errors
+ */
+ public void throwErrors() {
+ AssertionFailedError e = getWrappedErrors();
+ if (e != null) {
+ errorsThrown = true;
+ throw e;
+ }
+ }
+
+ public boolean hasThrown() {
+ return errorsThrown;
+ }
+
+ public ArrayList getErrors() {
+ return errors;
+ }
+
+ public AssertionFailedError getWrappedErrors() {
+
+ if (isEmpty())
+ return null;
+
+ String message = getErrorStackTraces();
+
+ if (message.equals(""))
+ return null;
+
+ return new AssertionFailedError(
+ "Error accumulator found and ignored the following errors in "
+ + getName() + ":" + message);
+
+ }
+}
diff --git a/src/main/java/org/finra/jtaf/core/asserts/IgnoreErrorsAssert.java b/src/main/java/org/finra/jtaf/core/asserts/IgnoreErrorsAssert.java
index 7d89ce6..dc26cd4 100644
--- a/src/main/java/org/finra/jtaf/core/asserts/IgnoreErrorsAssert.java
+++ b/src/main/java/org/finra/jtaf/core/asserts/IgnoreErrorsAssert.java
@@ -1,768 +1,678 @@
-/*
- * (C) Copyright 2014 Java Test Automation Framework Contributors.
- *
- * 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
- *
- * 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.finra.jtaf.core.asserts;
-
-import junit.framework.Assert;
-
-/**
- * This class is mainly a wrapper for Junits Assert class. Instead of
- * immediately throwing an error, the error is stored in an ErrorAccumulator to
- * be thrown when needed.
- *
- */
-public class IgnoreErrorsAssert {
-
- public ErrorAccumulator ea;
-
- /**
- * Called to instantiate this class
- *
- * @param ea
- * the ErrorAccumulator to be used to collect all exceptions
- */
- public IgnoreErrorsAssert(ErrorAccumulator ea) {
- this.ea = ea;
- }
-
- /**
- * Asserts that a condition is true. If it isn't, it stores a Throwable in
- * the accumulator with the given message.
- *
- * @param message
- * message to be thrown if condition is false
- * @param condition
- * the condition to be evaluated
- */
- @SuppressWarnings("deprecation")
- public void assertTrue(String message, boolean condition) {
- try {
- Assert.assertTrue(message, condition);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that a condition is true. If it isn't, it stores a Throwable in
- * the accumulator.
- *
- * @param condition
- * the condition to be evaluated
- */
- @SuppressWarnings("deprecation")
- public void assertTrue(boolean condition) {
- try {
- Assert.assertTrue(condition);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that a condition is false. If it isn't, it stores a Throwable in
- * the accumulator with the given message.
- *
- * @param message
- * message to be thrown if condition is true
- *
- * @param condition
- * the condition to be evaluated
- */
- @SuppressWarnings("deprecation")
- public void assertFalse(String message, boolean condition) {
- try {
- Assert.assertFalse(message, condition);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that a condition is false. If it isn't, it stores a Throwable in
- * the accumulator.
- *
- * @param condition
- * the condition to be evaluated
- */
- @SuppressWarnings("deprecation")
- public void assertFalse(boolean condition) {
- try {
- Assert.assertFalse(condition);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Fails a test with a Throwable being stored in the accumulator with the
- * given message.
- *
- * @param message
- * message to be thrown
- */
- @SuppressWarnings("deprecation")
- public void fail(String message) {
- try {
- Assert.fail(message);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Fails a test with a Throwable being stored in the accumulator with no
- * message.
- */
- @SuppressWarnings("deprecation")
- public void fail() {
- try {
- Assert.fail();
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects are equal. If they are not, a Throwable is
- * stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
-
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, Object expected, Object actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects are equal. If they are not an Throwable is
- * stored in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(Object expected, Object actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two Strings are equal. If they are not, a Throwable is
- * stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, String expected, String actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two Strings are equal. If they are not, a Throwable is
- * stored in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String expected, String actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two doubles are equal concerning a delta. If they are not, a
- * Throwable is stored in the accumulator with the given message. If the
- * expected value is infinity then the delta value is ignored.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- * @param delta
- * the difference allowed between the two values
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, double expected, double actual, double delta) {
- try {
- Assert.assertEquals(message, expected, actual, delta);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two doubles are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored. If they are not, a
- * Throwable is stored in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- * @param delta
- * the difference allowed between the two values
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(double expected, double actual, double delta) {
- try {
- Assert.assertEquals(expected, actual, delta);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two floats are equal concerning a positive delta. If they
- * are not, a Throwable is stored in the accumulator with the given message.
- * If the expected value is infinity then the delta value is ignored.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- * @param delta
- * the difference allowed between the two values
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, float expected, float actual, float delta) {
- try {
- Assert.assertEquals(message, expected, actual, delta);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two floats are equal concerning a delta. If the expected
- * value is infinity then the delta value is ignored. If they are not, a
- * Throwable is stored in the accumulator
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- * @param delta
- * the difference allowed between the two values
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(float expected, float actual, float delta) {
- try {
- Assert.assertEquals(expected, actual, delta);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two longs are equal. If they are not, a Throwable is stored
- * in the accumulator with the given message. If they are not, a Throwable
- * is stored in the accumulator
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, long expected, long actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two longs are equal. If they are not, a Throwable is stored
- * in the accumulator. If they are not, a Throwable is stored in the
- * accumulator
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(long expected, long actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two booleans are equal. If they are not, a Throwable is
- * stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, boolean expected, boolean actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two booleans are equal. If they are not, a Throwable is
- * stored in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(boolean expected, boolean actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two bytes are equal. If they are not an Throwable is thrown
- * with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, byte expected, byte actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two bytes are equal. If they are not, a Throwable is stored
- * in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(byte expected, byte actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two chars are equal. If they are not, a Throwable is stored
- * in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, char expected, char actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two chars are equal. If they are not, a Throwable is stored
- * in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(char expected, char actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two shorts are equal. If they are not, a Throwable is stored
- * in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- **/
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, short expected, short actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two shorts are equal. If they are not, a Throwable is stored
- * in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(short expected, short actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two ints are equal. If they are not, a Throwable is stored
- * in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(String message, int expected, int actual) {
- try {
- Assert.assertEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two ints are equal. If they are not, a Throwable is stored
- * in the accumulator.
- *
- * @param expected
- * expected value
- * @param actual
- * actual value that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertEquals(int expected, int actual) {
- try {
- Assert.assertEquals(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that an object isn't null. If they are not, a Throwable is stored
- * in the accumulator.
- *
- * @param object
- * object to be checked to see if it is null or not
- */
- @SuppressWarnings("deprecation")
- public void assertNotNull(Object object) {
- try {
- Assert.assertNotNull(object);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that an object isn't null. If they are not, a Throwable is stored
- * in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param object
- * object to be checked to see if it is null or not
- */
- @SuppressWarnings("deprecation")
- public void assertNotNull(String message, Object object) {
- try {
- Assert.assertNotNull(message, object);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that an object is null. If they are not, a Throwable is stored in
- * the accumulator.
- *
- * @param object
- * Object to check to see if it is null
- */
- @SuppressWarnings("deprecation")
- public void assertNull(Object object) {
- try {
- Assert.assertNull(object);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that an object is null. If they are not, a Throwable is stored in
- * the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not equal
- * @param object
- * object to be checked to see if it is null or not
- */
- @SuppressWarnings("deprecation")
- public void assertNull(String message, Object object) {
- try {
- Assert.assertNull(message, object);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects refer to the same object. If they are not, a
- * Throwable is stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if not the same
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertSame(String message, Object expected, Object actual) {
- try {
- Assert.assertSame(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects refer to the same object. If they are not, a
- * Throwable is stored in the accumulator.
- *
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertSame(Object expected, Object actual) {
- try {
- Assert.assertSame(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects do not refer to the same object. If they are
- * not, a Throwable is stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if they are the same
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertNotSame(String message, Object expected, Object actual) {
- try {
- Assert.assertNotSame(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
-
- }
-
- /**
- * Asserts that two objects do not refer to the same object. If they are
- * not, a Throwable is stored in the accumulator.
- *
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void assertNotSame(Object expected, Object actual) {
- try {
- Assert.assertNotSame(expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Asserts that two objects do refer to the same object. If they are not, a
- * Throwable is stored in the accumulator with the given message.
- *
- * @param message
- * message to be thrown if they are the same
- */
- @SuppressWarnings("deprecation")
- public void failSame(String message) {
- try {
- Assert.failSame(message);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Calls the Assert classes failNotSame method which creates an exception
- * using the given message and object
- *
- * @param message
- * message to be thrown if they are the same
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void failNotSame(String message, Object expected, Object actual) {
-
- try {
- Assert.failNotSame(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Calls the Assert classes failNotEquals method which creates an exception
- * using the given message and objects
- *
- * @param message
- * message to be thrown if they are the same
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public void failNotEquals(String message, Object expected, Object actual) {
- try {
- Assert.failNotEquals(message, expected, actual);
- } catch (Throwable e) {
- ea.addError(e);
- }
- }
-
- /**
- * Calls the Assert classes format method which creates a formatted string
- * using the given message and objects to be used for an exception
- *
- * @param message
- * message to be thrown if they are the same
- * @param expected
- * expected object
- * @param actual
- * actual object that is being checked
- */
- @SuppressWarnings("deprecation")
- public String format(String message, Object expected, Object actual) {
- return Assert.format(message, expected, actual);
- }
-
- /**
- * Throws all of the accumulated errors.
- */
- public void endOfCommand() {
- ea.throwErrors();
-
- }
-
- /**
- * Used to check if there are any recorded errors.
- *
- * @return returns the errors that have been recorded.
- */
- public String checkErrors() {
- return ea.getErrorMessages();
- }
-}
+/*
+ * (C) Copyright 2014 Java Test Automation Framework Contributors.
+ *
+ * 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
+ *
+ * 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.finra.jtaf.core.asserts;
+
+import junit.framework.Assert;
+
+/**
+ * This class is mainly a wrapper for Junits Assert class. Instead of
+ * immediately throwing an error, the error is stored in an ErrorAccumulator to
+ * be thrown when needed.
+ */
+public class IgnoreErrorsAssert {
+
+ public ErrorAccumulator ea;
+
+ /**
+ * Called to instantiate this class
+ *
+ * @param ea the ErrorAccumulator to be used to collect all exceptions
+ */
+ public IgnoreErrorsAssert(ErrorAccumulator ea) {
+ this.ea = ea;
+ }
+
+ /**
+ * Asserts that a condition is true. If it isn't, it stores a Throwable in
+ * the accumulator with the given message.
+ *
+ * @param message message to be thrown if condition is false
+ * @param condition the condition to be evaluated
+ */
+ @SuppressWarnings("deprecation")
+ public void assertTrue(String message, boolean condition) {
+ try {
+ Assert.assertTrue(message, condition);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that a condition is true. If it isn't, it stores a Throwable in
+ * the accumulator.
+ *
+ * @param condition the condition to be evaluated
+ */
+ @SuppressWarnings("deprecation")
+ public void assertTrue(boolean condition) {
+ try {
+ Assert.assertTrue(condition);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that a condition is false. If it isn't, it stores a Throwable in
+ * the accumulator with the given message.
+ *
+ * @param message message to be thrown if condition is true
+ * @param condition the condition to be evaluated
+ */
+ @SuppressWarnings("deprecation")
+ public void assertFalse(String message, boolean condition) {
+ try {
+ Assert.assertFalse(message, condition);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that a condition is false. If it isn't, it stores a Throwable in
+ * the accumulator.
+ *
+ * @param condition the condition to be evaluated
+ */
+ @SuppressWarnings("deprecation")
+ public void assertFalse(boolean condition) {
+ try {
+ Assert.assertFalse(condition);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Fails a test with a Throwable being stored in the accumulator with the
+ * given message.
+ *
+ * @param message message to be thrown
+ */
+ @SuppressWarnings("deprecation")
+ public void fail(String message) {
+ try {
+ Assert.fail(message);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Fails a test with a Throwable being stored in the accumulator with no
+ * message.
+ */
+ @SuppressWarnings("deprecation")
+ public void fail() {
+ try {
+ Assert.fail();
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects are equal. If they are not, a Throwable is
+ * stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, Object expected, Object actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects are equal. If they are not an Throwable is
+ * stored in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(Object expected, Object actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two Strings are equal. If they are not, a Throwable is
+ * stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, String expected, String actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two Strings are equal. If they are not, a Throwable is
+ * stored in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String expected, String actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two doubles are equal concerning a delta. If they are not, a
+ * Throwable is stored in the accumulator with the given message. If the
+ * expected value is infinity then the delta value is ignored.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ * @param delta the difference allowed between the two values
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, double expected, double actual, double delta) {
+ try {
+ Assert.assertEquals(message, expected, actual, delta);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two doubles are equal concerning a delta. If the expected
+ * value is infinity then the delta value is ignored. If they are not, a
+ * Throwable is stored in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ * @param delta the difference allowed between the two values
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(double expected, double actual, double delta) {
+ try {
+ Assert.assertEquals(expected, actual, delta);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two floats are equal concerning a positive delta. If they
+ * are not, a Throwable is stored in the accumulator with the given message.
+ * If the expected value is infinity then the delta value is ignored.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ * @param delta the difference allowed between the two values
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, float expected, float actual, float delta) {
+ try {
+ Assert.assertEquals(message, expected, actual, delta);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two floats are equal concerning a delta. If the expected
+ * value is infinity then the delta value is ignored. If they are not, a
+ * Throwable is stored in the accumulator
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ * @param delta the difference allowed between the two values
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(float expected, float actual, float delta) {
+ try {
+ Assert.assertEquals(expected, actual, delta);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two longs are equal. If they are not, a Throwable is stored
+ * in the accumulator with the given message. If they are not, a Throwable
+ * is stored in the accumulator
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, long expected, long actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two longs are equal. If they are not, a Throwable is stored
+ * in the accumulator. If they are not, a Throwable is stored in the
+ * accumulator
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(long expected, long actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two booleans are equal. If they are not, a Throwable is
+ * stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, boolean expected, boolean actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two booleans are equal. If they are not, a Throwable is
+ * stored in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(boolean expected, boolean actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two bytes are equal. If they are not an Throwable is thrown
+ * with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, byte expected, byte actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two bytes are equal. If they are not, a Throwable is stored
+ * in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(byte expected, byte actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two chars are equal. If they are not, a Throwable is stored
+ * in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, char expected, char actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two chars are equal. If they are not, a Throwable is stored
+ * in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(char expected, char actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two shorts are equal. If they are not, a Throwable is stored
+ * in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ **/
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, short expected, short actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two shorts are equal. If they are not, a Throwable is stored
+ * in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(short expected, short actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two ints are equal. If they are not, a Throwable is stored
+ * in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(String message, int expected, int actual) {
+ try {
+ Assert.assertEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two ints are equal. If they are not, a Throwable is stored
+ * in the accumulator.
+ *
+ * @param expected expected value
+ * @param actual actual value that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertEquals(int expected, int actual) {
+ try {
+ Assert.assertEquals(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that an object isn't null. If they are not, a Throwable is stored
+ * in the accumulator.
+ *
+ * @param object object to be checked to see if it is null or not
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNotNull(Object object) {
+ try {
+ Assert.assertNotNull(object);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that an object isn't null. If they are not, a Throwable is stored
+ * in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param object object to be checked to see if it is null or not
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNotNull(String message, Object object) {
+ try {
+ Assert.assertNotNull(message, object);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that an object is null. If they are not, a Throwable is stored in
+ * the accumulator.
+ *
+ * @param object Object to check to see if it is null
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNull(Object object) {
+ try {
+ Assert.assertNull(object);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that an object is null. If they are not, a Throwable is stored in
+ * the accumulator with the given message.
+ *
+ * @param message message to be thrown if not equal
+ * @param object object to be checked to see if it is null or not
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNull(String message, Object object) {
+ try {
+ Assert.assertNull(message, object);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects refer to the same object. If they are not, a
+ * Throwable is stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if not the same
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertSame(String message, Object expected, Object actual) {
+ try {
+ Assert.assertSame(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects refer to the same object. If they are not, a
+ * Throwable is stored in the accumulator.
+ *
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertSame(Object expected, Object actual) {
+ try {
+ Assert.assertSame(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects do not refer to the same object. If they are
+ * not, a Throwable is stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if they are the same
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNotSame(String message, Object expected, Object actual) {
+ try {
+ Assert.assertNotSame(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+
+ }
+
+ /**
+ * Asserts that two objects do not refer to the same object. If they are
+ * not, a Throwable is stored in the accumulator.
+ *
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void assertNotSame(Object expected, Object actual) {
+ try {
+ Assert.assertNotSame(expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Asserts that two objects do refer to the same object. If they are not, a
+ * Throwable is stored in the accumulator with the given message.
+ *
+ * @param message message to be thrown if they are the same
+ */
+ @SuppressWarnings("deprecation")
+ public void failSame(String message) {
+ try {
+ Assert.failSame(message);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Calls the Assert classes failNotSame method which creates an exception
+ * using the given message and object
+ *
+ * @param message message to be thrown if they are the same
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void failNotSame(String message, Object expected, Object actual) {
+
+ try {
+ Assert.failNotSame(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Calls the Assert classes failNotEquals method which creates an exception
+ * using the given message and objects
+ *
+ * @param message message to be thrown if they are the same
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public void failNotEquals(String message, Object expected, Object actual) {
+ try {
+ Assert.failNotEquals(message, expected, actual);
+ } catch (Throwable e) {
+ ea.addError(e);
+ }
+ }
+
+ /**
+ * Calls the Assert classes format method which creates a formatted string
+ * using the given message and objects to be used for an exception
+ *
+ * @param message message to be thrown if they are the same
+ * @param expected expected object
+ * @param actual actual object that is being checked
+ */
+ @SuppressWarnings("deprecation")
+ public String format(String message, Object expected, Object actual) {
+ return Assert.format(message, expected, actual);
+ }
+
+ /**
+ * Throws all of the accumulated errors.
+ */
+ public void endOfCommand() {
+ ea.throwErrors();
+
+ }
+
+ /**
+ * Used to check if there are any recorded errors.
+ *
+ * @return returns the errors that have been recorded.
+ */
+ public String checkErrors() {
+ return ea.getErrorMessages();
+ }
+}
diff --git a/src/main/java/org/finra/jtaf/core/commands/Block.java b/src/main/java/org/finra/jtaf/core/commands/Block.java
index a3f6c7b..f2237f0 100644
--- a/src/main/java/org/finra/jtaf/core/commands/Block.java
+++ b/src/main/java/org/finra/jtaf/core/commands/Block.java
@@ -27,7 +27,6 @@
/**
* This is a collection of commands that are to be executed.
- *
*/
public class Block extends Command {
@@ -36,9 +35,8 @@ public class Block extends Command {
* interpreter.The recordResult variable is set to false because details
* about the Block step aren't needed, unlike the commands within the
* Block block.
- *
- * @param name
- * - name of the command
+ *
+ * @param name - name of the command
* @throws NameFormatException
*/
public Block(String name) throws NameFormatException {
@@ -49,12 +47,9 @@ public Block(String name) throws NameFormatException {
/**
* This goes through all commands in the context and executes them.
- *
- * @param ctx
- * - The current context when this method is executed.
- *
- * @throws Throwable
- * - Any exception thrown by a command within the Block.
+ *
+ * @param ctx - The current context when this method is executed.
+ * @throws Throwable - Any exception thrown by a command within the Block.
*/
@SuppressWarnings("unchecked")
@Override
diff --git a/src/main/java/org/finra/jtaf/core/commands/ExpectFailure.java b/src/main/java/org/finra/jtaf/core/commands/ExpectFailure.java
index 7d19b86..c9fa369 100644
--- a/src/main/java/org/finra/jtaf/core/commands/ExpectFailure.java
+++ b/src/main/java/org/finra/jtaf/core/commands/ExpectFailure.java
@@ -29,7 +29,6 @@
* to throw an exception. If one of them throws an exception, no more commands
* from the block are executed and the remainder of the script is run through.
* If no exception is thrown, an ExpectedFailureException to signify this.
- *
*/
public class ExpectFailure extends Command {
@@ -38,9 +37,8 @@ public class ExpectFailure extends Command {
* interpreter. The recordResult variable is set to false because details
* about the ExpectFailure step aren't needed, unlike the commands within
* the ExpectFailure block.
- *
- * @param name
- * - The name of the command
+ *
+ * @param name - The name of the command
* @throws NameFormatException
*/
public ExpectFailure(String name) throws NameFormatException {
@@ -58,12 +56,10 @@ public ExpectFailure(String name) throws NameFormatException {
* exception is an ExpectedFailureException, it is thrown and if no
* exception is encountered when executing the block, a new
* ExpectedFailureException is thrown.
- *
- * @param ctx
- * - The current context when this method is executed.
- * @throws Throwable
- * - Either a ExpectedFailureException or the exception thrown
- * by a command in the block
+ *
+ * @param ctx - The current context when this method is executed.
+ * @throws Throwable - Either a ExpectedFailureException or the exception thrown
+ * by a command in the block
*/
@SuppressWarnings("unchecked")
@Override
diff --git a/src/main/java/org/finra/jtaf/core/commands/FailHere.java b/src/main/java/org/finra/jtaf/core/commands/FailHere.java
index 01b4e09..9c3817a 100644
--- a/src/main/java/org/finra/jtaf/core/commands/FailHere.java
+++ b/src/main/java/org/finra/jtaf/core/commands/FailHere.java
@@ -24,16 +24,14 @@
/**
* This command is used to force a failure. This is mainly used for testing
* other commands to make sure that they work correctly.
- *
*/
public class FailHere extends Command {
/**
* This called when instantiating the command before it is executed by the
* interpreter
- *
- * @param name
- * - The name of the command
+ *
+ * @param name - The name of the command
* @throws NameFormatException
*/
public FailHere(String name) throws NameFormatException {
@@ -43,11 +41,9 @@ public FailHere(String name) throws NameFormatException {
/**
* This method throws an AssertionFailedException to force a failure.
- *
- * @param ctx
- * - The current context when this method is executed.
- * @throws Throwable
- * - The AssertionFailedException
+ *
+ * @param ctx - The current context when this method is executed.
+ * @throws Throwable - The AssertionFailedException
*/
@Override
protected void execute(IInvocationContext ctx) throws Throwable {
diff --git a/src/main/java/org/finra/jtaf/core/commands/IgnoreErrors.java b/src/main/java/org/finra/jtaf/core/commands/IgnoreErrors.java
index b5aded9..6b9dfce 100644
--- a/src/main/java/org/finra/jtaf/core/commands/IgnoreErrors.java
+++ b/src/main/java/org/finra/jtaf/core/commands/IgnoreErrors.java
@@ -1,87 +1,84 @@
-/*
- * (C) Copyright 2014 Java Test Automation Framework Contributors.
- *
- * 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
- *
- * 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.finra.jtaf.core.commands;
-
-import java.util.ArrayList;
-
-import org.finra.jtaf.core.model.exceptions.NameFormatException;
-import org.finra.jtaf.core.model.execution.IInvocationContext;
-import org.finra.jtaf.core.model.invocationtarget.Command;
-import org.finra.jtaf.core.model.statement.Invocation;
-
-/**
- * This command surrounds a block of commands to be executed. If one of them
- * throws an exception, it is stored to be reported at the end of the test and
- * any commands after this block are then executed.
- *
- */
-public class IgnoreErrors extends Command {
-
- /**
- * This called when instantiating the command before it is executed by the
- * interpreter. The recordResult variable is set to false because details
- * about the IgnoreErrors step aren't needed, unlike the commands within the
- * IgnoreErrors block.
- *
- * @param name
- * - The name of the command
- * @throws NameFormatException
- */
- public IgnoreErrors(String name) throws NameFormatException {
- super(name);
- recordResult = false;
-
- }
-
- /**
- * This method goes through all of the commands within the IgnoreErrors
- * block and executes them until they have all been executed or an exception
- * has been thrown. If an exception is thrown, it is stored in the
- * ErrorAccumulator to be reported at the end of the test.
- *
- * @param ctx
- * - The current context when this method is executed.
- */
- @SuppressWarnings("unchecked")
- @Override
- protected void execute(IInvocationContext ctx) {
- ArrayList