Package play.test

Source Code of play.test.PlayJUnitRunnerTest

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());
  }
 
}
TOP

Related Classes of play.test.PlayJUnitRunnerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.