jsevellec / cassandra-unit

Utility tool to load Data into Cassandra to help you writing good isolated JUnit Test into your application
GNU Lesser General Public License v3.0
424 stars 0 forks source link

Doesn't work with the spring SpringExtension.class #293

Open FearlessHyena opened 5 years ago

FearlessHyena commented 5 years ago

I'm currently using Kotlin and the SpringExtension::class doesn't seem to work and fails to start the EmbeddedCassandra instance resulting in a com.datastax.driver.core.exceptions.NoHostAvailableException

Here are the settings that I've tried with Neither the @CassandraDataSet nor the @EmbeddedCassandra seem to be picked up

@ExtendWith(SpringExtension::class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestExecutionListeners(
    listeners = [CassandraUnitDependencyInjectionTestExecutionListener::class, DependencyInjectionTestExecutionListener::class]
)
@CassandraDataSet(value = ["db/dataset.cql"], keyspace = "test")
@EmbeddedCassandra
internal class IntegrationTest {

  @Test fun test() {
  }
}

Switching to the SpringJUnit4ClassRunner::class fixes the problem Is this a known issue?

FearlessHyena commented 5 years ago

no one had this issue yet? Want to switch to JUnit 5 but this is keeping me from it

asarkar commented 3 years ago

I've created a cassandra-unit-spring library that starts the Cassandra server and makes the ports available as Spring Boot environment properties. It works with JUnit 5, and is designed like the @AutoConfigureWireMock provided by Spring Cloud.