Permalink
Browse files

[960] UnrootedTests when running single test in Eclipse

  • Loading branch information...
skamille committed Nov 30, 2011
1 parent 9639710 commit eec1cc3e29373477ed5daae834a4b8f82b645162
Binary file not shown.
@@ -0,0 +1,40 @@
+package play.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doCallRealMethod;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runners.JUnit4;
+
+public class PlayJUnitRunnerTest {
+
+ @Test
+ public void testFilter() throws Exception {
+ PlayJUnitRunner runner = mock(PlayJUnitRunner.class);
+ runner.jUnit4 = new JUnit4(PlayJUnitRunnerTest.class);
+ doCallRealMethod().when(runner).filter((Filter) any());
+
+ runner.filter(new Filter() {
+
+ @Override
+ public boolean shouldRun(Description arg0) {
+ return arg0.getMethodName().indexOf("testFilter") > -1;
+ }
+
+ @Override
+ public String describe() {
+ return "";
+ }
+ });
+
+ when(runner.testCount()).thenCallRealMethod();
+ when(runner.getDescription()).thenCallRealMethod();
+ assertEquals(1, runner.testCount());
+ }
+
+}

0 comments on commit eec1cc3

Please sign in to comment.