Skip to content

Instantly share code, notes, and snippets.

@hstaudacher
Created February 24, 2014 10:08
Show Gist options
  • Save hstaudacher/9184996 to your computer and use it in GitHub Desktop.
Save hstaudacher/9184996 to your computer and use it in GitHub Desktop.
A simple JUnit Rule to setup and teardown RWT
/*******************************************************************************
* Copyright (c) 2014 EclipseSource and others.
* 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:
* EclipseSource - initial API and implementation
******************************************************************************/
package com.eclipsesource.tabris.test;
import org.eclipse.rap.rwt.testfixture.Fixture;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
public class RWTRule implements TestRule {
@Override
public Statement apply( final Statement base, Description description ) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
Fixture.setUp();
base.evaluate();
} finally {
Fixture.tearDown();
}
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment