mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
Refactor move tests from ebean-core to ebean-test
This commit is contained in:
1 parent
0b00a14fd3
commit
eab56d323b
1650 files changed
+185
-147
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TableModStateTest {
|
||||
|
||||
private TableModState tableModState = new TableModState();
|
||||
|
||||
@Test
|
||||
public void isValid() {
|
||||
|
||||
long before = System.nanoTime();
|
||||
|
||||
tableModState.touch(setOf("one", "two", "three"));
|
||||
|
||||
long after = System.nanoTime();
|
||||
|
||||
// empty
|
||||
assertTrue(tableModState.isValid(Collections.emptySet(), 12L));
|
||||
|
||||
// no entry
|
||||
assertTrue(tableModState.isValid(setOf("noEntry"), 12L));
|
||||
|
||||
// later timestamp
|
||||
assertTrue(tableModState.isValid(setOf("one"), after));
|
||||
assertTrue(tableModState.isValid(setOf("one", "two", "noEntry"), after));
|
||||
|
||||
// invalid
|
||||
assertFalse(tableModState.isValid(setOf("one"), before));
|
||||
assertFalse(tableModState.isValid(setOf("one", "two"), before));
|
||||
assertFalse(tableModState.isValid(setOf("three", "two"), before));
|
||||
|
||||
}
|
||||
|
||||
private Set<String> setOf(String... tables) {
|
||||
Set<String> touched = new HashSet<>();
|
||||
Collections.addAll(touched, tables);
|
||||
return touched;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user