File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
complete/src/test/java/com/example/accessingdatacassandra Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 44
55import org .junit .jupiter .api .Test ;
66
7+ import org .springframework .beans .factory .annotation .Autowired ;
78import org .springframework .boot .autoconfigure .cassandra .CassandraProperties ;
89import org .springframework .boot .test .context .SpringBootTest ;
910import org .springframework .boot .test .context .TestConfiguration ;
11+ import org .springframework .data .cassandra .CassandraInvalidQueryException ;
1012import org .springframework .data .cassandra .config .AbstractCassandraConfiguration ;
1113import org .springframework .data .cassandra .config .SchemaAction ;
1214import org .springframework .data .cassandra .core .cql .keyspace .CreateKeyspaceSpecification ;
1315import org .springframework .data .cassandra .core .cql .keyspace .SpecificationBuilder ;
1416import org .springframework .lang .NonNull ;
1517
18+ import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
19+
1620@ SpringBootTest
1721class AccessingDataCassandraApplicationTests {
1822
23+ @ Autowired
24+ VetRepository vets ;
25+
1926 @ Test
2027 void contextLoads () {
2128 }
2229
30+ @ Test
31+ void findByFirstNameWhenNotAllowFilteringThenFails () {
32+ assertThatExceptionOfType (CassandraInvalidQueryException .class )
33+ .isThrownBy (() -> this .vets .findByFirstName ("somename" ));
34+ }
35+
2336 @ TestConfiguration
2437 static class CreateKeyspaceConfiguration extends AbstractCassandraConfiguration {
2538
You can’t perform that action at this time.
0 commit comments