package ${package};

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.ociweb.iot.hardware.impl.test.TestHardware;
import com.ociweb.iot.maker.FogRuntime;
import com.ociweb.pronghorn.stage.scheduling.NonThreadScheduler;

/**
 * Unit test for simple App.
 */
public class AppTest { 

	
	 @Test
	    public void testApp()
	    {
		    FogRuntime runtime = FogRuntime.test(new ${artifactId}());	    	
	    	NonThreadScheduler scheduler = (NonThreadScheduler)runtime.getScheduler();    	
	    	TestHardware hardware = (TestHardware)runtime.getHardware();
	    
	    	scheduler.startup();
	    	
	    	int iterations = 10;
			while (--iterations >= 0) {
				    		
					scheduler.run();
					
					//test application here
					
			}
			
			scheduler.shutdown();
			
	    }
}

@@ -404,431 +404,120 @@
     
-FogRuntime runtime = FogRuntime.test(new $%7BartifactId%7D());%09    %09%0A%09    %09NonThreadScheduler scheduler = (NonThreadScheduler)runtime.getScheduler();    %09%0A%09    %09TestHardware hardware = (TestHardware)runtime.getHardware();%0A%09    %0A%09    %09scheduler.startup();%0A%09    %09%0A%09    %09int iterations = 10;%0A%09%09%09while (--iterations %3E= 0) %7B%0A%09%09%09%09    %09%09%0A%09%09%09%09%09scheduler.run();%0A%09%09%09%09%09%0A%09%09%09%09%09//test application here%0A%09%09%09%09%09%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09scheduler.shutdown();
+int timeoutMS = 2000;%0A%09%09    GreenRuntime.testUntilShutdownRequested(new $%7BartifactId%7D(), timeoutMS);%0A%09%09    %09    
 %0A%09%09%09
@@ -524,10 +524,11 @@
 %0A%09    %7D%0A
+%0A
 %7D%0A

change to new testing style