I'd like to test my SpringBoot application that uses cassandra as a CrudRepository. I ended up with
/*
* http://ift.tt/1UcRqfK
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ComponentScan
@ContextConfiguration(value = { "classpath:/default-context.xml" })
@TestExecutionListeners({ CassandraUnitTestExecutionListener.class })
@CassandraDataSet(value = { "setupTables.cql" }, keyspace = "keyspaceToCreate")
@CassandraUnit
public class ApplicationTests {
@Autowired
MyCassandraRepository repo;
@Test
public void contextLoads() {
System.out.println(repo.findAll());
}
}
This leads to a NullPointerException because repo isn't injected. What am I doing wrong?
Sources http://ift.tt/2auIZeq
Aucun commentaire:
Enregistrer un commentaire