Search in sources :

Example 6 with ShardingEnvironment

use of com.google.testing.junit.runner.sharding.ShardingEnvironment in project bazel by bazelbuild.

the class JUnit4TestModelBuilderTest method testDoesNotTouchShardFileWhenShardingDisabled.

@Test
public void testDoesNotTouchShardFileWhenShardingDisabled() {
    Class<?> testClass = SampleTestCaseWithTwoTests.class;
    Request request = Request.classWithoutSuiteMethod(testClass);
    ShardingEnvironment mockShardingEnvironment = mock(ShardingEnvironment.class);
    ShardingFilters shardingFilters = new ShardingFilters(mockShardingEnvironment, DEFAULT_SHARDING_STRATEGY);
    JUnit4TestModelBuilder modelBuilder = builder(request, testClass.getCanonicalName(), mockShardingEnvironment, shardingFilters, xmlResultWriter);
    when(mockShardingEnvironment.isShardingEnabled()).thenReturn(false);
    modelBuilder.get();
    verify(mockShardingEnvironment, never()).touchShardFile();
}
Also used : Request(org.junit.runner.Request) ShardingFilters(com.google.testing.junit.runner.sharding.ShardingFilters) StubShardingEnvironment(com.google.testing.junit.runner.sharding.testing.StubShardingEnvironment) ShardingEnvironment(com.google.testing.junit.runner.sharding.ShardingEnvironment) Test(org.junit.Test)

Aggregations

ShardingEnvironment (com.google.testing.junit.runner.sharding.ShardingEnvironment)6 Test (org.junit.Test)6 SettableCurrentRunningTest (com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest)4 FakeShardingFilters (com.google.testing.junit.runner.sharding.testing.FakeShardingFilters)4 CurrentRunningTest (com.google.testing.junit.runner.util.CurrentRunningTest)4 Result (org.junit.runner.Result)4 ShardingFilters (com.google.testing.junit.runner.sharding.ShardingFilters)3 StubShardingEnvironment (com.google.testing.junit.runner.sharding.testing.StubShardingEnvironment)2 Request (org.junit.runner.Request)2 Description (org.junit.runner.Description)1