package org.jboss.reddeer.swt.test.condition;

import org.jboss.reddeer.eclipse.ui.perspectives.JavaPerspective;
import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
import org.jboss.reddeer.swt.condition.ConstructorFinishedSuccessfully;
import org.jboss.reddeer.swt.condition.JobIsRunning;
import org.jboss.reddeer.swt.exception.WaitTimeoutExpiredException;
import org.jboss.reddeer.swt.impl.shell.DefaultShell;
import org.jboss.reddeer.swt.wait.WaitUntil;
import org.jboss.reddeer.swt.wait.WaitWhile;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
 * Tests ConstructorFinishedSuccessfully condition
 * @author Vlado Pakan
 *
 */
@RunWith(RedDeerSuite.class)
@OpenPerspective(JavaPerspective.class)
public class ConstructorFinishedSuccessfullyTest {

	@Before
	public void setUp(){
		new WaitWhile(new JobIsRunning());
	}
	
	@Test
	public void constructorRunOK(){
		new WaitUntil(new ConstructorFinishedSuccessfully(DefaultShell.class,
			null,
			null));
	}
	
	@Test(expected = WaitTimeoutExpiredException.class)
	public void constructorFailed(){
		new WaitUntil(new ConstructorFinishedSuccessfully(DefaultShell.class,
			new Class<?>[] {String.class},
			new Object[] {"!@#_NON_EXISTING_SHELL_*&^%"}));
	}
}




@@ -332,61 +332,8 @@
 ly;%0A
-import org.jboss.reddeer.swt.condition.JobIsRunning;%0A
 impo
@@ -396,16 +396,16 @@
 eption;%0A
+
 import o
@@ -499,78 +499,8 @@
 il;%0A
-import org.jboss.reddeer.swt.wait.WaitWhile;%0Aimport org.junit.Before;%0A
 impo
@@ -705,16 +705,16 @@
 .class)%0A
+
 public c
@@ -759,80 +759,8 @@
 st %7B
-%0A%0A%09@Before%0A%09public void setUp()%7B%0A%09%09new WaitWhile(new JobIsRunning());%0A%09%7D
 %0A%09%0A%09

Remove waiting for unfinshed jobs in ConstructorFinishedSuccessfullyTest. Fixes #866