Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CommandRunnableTests.java')
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CommandRunnableTests.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CommandRunnableTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CommandRunnableTests.java
new file mode 100644
index 0000000000..717d813f69
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CommandRunnableTests.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.utility.tests.internal;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jpt.utility.Command;
+import org.eclipse.jpt.utility.internal.CommandRunnable;
+
+@SuppressWarnings("nls")
+public class CommandRunnableTests extends TestCase {
+ boolean commandExecuted = false;
+
+ public CommandRunnableTests(String name) {
+ super(name);
+ }
+
+ public void testNullCommand() {
+ boolean exCaught = false;
+ try {
+ Runnable runnable = new CommandRunnable(null);
+ fail("bogus: " + runnable);
+ } catch (NullPointerException ex) {
+ exCaught = true;
+ }
+ assertTrue(exCaught);
+ }
+
+ public void testRun() {
+ Runnable runnable = new CommandRunnable(this.buildCommand());
+ runnable.run();
+ assertTrue(this.commandExecuted);
+ }
+
+ public void testToString() {
+ Runnable runnable = new CommandRunnable(this.buildCommand());
+ assertNotNull(runnable.toString());
+ }
+
+ private Command buildCommand() {
+ return new Command() {
+ public void execute() {
+ CommandRunnableTests.this.commandExecuted = true;
+ }
+ };
+ }
+
+}

Back to the top