52 lines
1.5 KiB
Java
52 lines
1.5 KiB
Java
package com.quantai.trader.domain;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import java.time.Instant;
|
|
import java.util.Map;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|
|
|
class TraderDataSourceManifestTest {
|
|
|
|
@Test
|
|
void requiresFullHashOrSchemaRowTimeLineage() {
|
|
assertThatThrownBy(() -> manifest(null, null, null, null, null))
|
|
.isInstanceOf(TraderException.class)
|
|
.hasMessageContaining("content hash");
|
|
}
|
|
|
|
@Test
|
|
void acceptsFullHash() {
|
|
assertThatCode(() -> manifest("abc", null, null, null, null)).doesNotThrowAnyException();
|
|
}
|
|
|
|
@Test
|
|
void acceptsSchemaLineageForLargeFiles() {
|
|
assertThatCode(() -> manifest(null, "schema", 100L, Instant.parse("2026-01-01T00:00:00Z"), Instant.parse("2026-01-02T00:00:00Z")))
|
|
.doesNotThrowAnyException();
|
|
}
|
|
|
|
private TraderDataSourceManifest manifest(String hash, String schema, Long rows, Instant min, Instant max) {
|
|
return new TraderDataSourceManifest(
|
|
"source-1",
|
|
"BTCUSDT",
|
|
"candles",
|
|
"BINANCE",
|
|
"1m",
|
|
"/tmp/candles.parquet",
|
|
hash,
|
|
schema,
|
|
Instant.parse("2026-01-01T00:00:00Z"),
|
|
Instant.parse("2026-01-02T00:00:00Z"),
|
|
min,
|
|
max,
|
|
"UTC",
|
|
rows,
|
|
Map.of(),
|
|
"P0_ACCEPTED"
|
|
);
|
|
}
|
|
}
|