Skip to content

Instantly share code, notes, and snippets.

@mihaita-tinta
Created December 22, 2023 14:59
Show Gist options
  • Save mihaita-tinta/1a6ff2145a2616a542b3e7d2ae9b69ee to your computer and use it in GitHub Desktop.
Save mihaita-tinta/1a6ff2145a2616a542b3e7d2ae9b69ee to your computer and use it in GitHub Desktop.
simplified
package com.mih.playground.driver;
import com.datastax.driver.core.utils.UUIDs;
import com.mih.playground.Infrastructure;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.cassandra.DataCassandraTest;
import org.springframework.context.annotation.Import;
import java.time.ZonedDateTime;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@DataCassandraTest
@Import(Infrastructure.class)
class DriverRepositoryTest {
@Autowired
DriverRepository repository;
@Test
void test() {
Driver driver = new Driver(UUIDs.timeBased(), ZonedDateTime.now().toEpochSecond(), "nickname");
Driver db = repository.save(driver);
assertNotNull(db.getId());
assertEquals(1, repository.findAll().size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment