-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Description
run spring test cases in paralleled way got errors.
I am trying to make the spring tests run faster, now I am using bazel, but the speed is not fast enough, now I want to run the spring test cases in paralleled way, so I modified the bazel's source code a little, the changed code is here https://github.com/ddwolf/bazel/commit/d7e370c38a6a64b2e987b7f942241733cdc01c17
and the test case is here
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ControllerConfiguration.class)
@WebAppConfiguration
public class EnvironmentControllerIntegrationTests {
@Autowired
private WebApplicationContext context;
private MockMvc mvc;
private EnvironmentRepository repository;
@Autowired
private void setEnvironmentRepository(EnvironmentRepository repo){
if(null == repo) return;
this.repository=repo;
}
@Before
public void init() {
Mockito.reset(this.repository);
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void environmentWithLabelContainingSlash() throws Exception {
Mockito.when(this.repository.findOne("foo", "default", "feature/puff"))
.thenReturn(new Environment("foo", "default"));
this.mvc.perform(MockMvcRequestBuilders.get("/foo/default/feature(_)puff"))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().string(Matchers.containsString("\"propertySources\":")));
}
@Configuration
@EnableWebMvc
@Import(PropertyPlaceholderAutoConfiguration.class)
public static class ControllerConfiguration {
@Bean
public EnvironmentRepository environmentRepository() {
EnvironmentRepository repository = Mockito.mock(EnvironmentRepository.class);
return repository;
}
@Bean
public EnvironmentController controller() {
return new EnvironmentController(environmentRepository());
}
}
}the error message I got is
org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is null!
it seems that the @test method runs before the auto wiring phase of spring, can you help with me about this? or where can I get help with?
Thanks.
Environment info
-
Operating System: Ubuntu 14.04
-
Bazel version (output of
bazel info release): bazel-0.4.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels