Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Oct 14, 2024
1 parent 9361b6b commit e69e1d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public Builder<T> until(final SpecMilestone untilMilestone) {
return this;
}

public Builder<T> constant(final boolean isConstant) {
this.isConstant = isConstant;
public Builder<T> constant() {
this.isConstant = true;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static SchemaRegistryBuilder create() {
private static SchemaProvider<SszBitvectorSchema<SszBitvector>>
createAttnetsENRFieldSchemaProvider() {
return providerBuilder(ATTNETS_ENR_FIELD_SCHEMA)
.constant(true)
.constant()
.withCreator(
SpecMilestone.PHASE0,
(registry, specConfig) ->
Expand All @@ -55,7 +55,7 @@ public static SchemaRegistryBuilder create() {

private static SchemaProvider<AttestationSchema<Attestation>> createAttestationSchemaProvider() {
return providerBuilder(ATTESTATION_SCHEMA)
.constant(true)
.constant()
.withCreator(
SpecMilestone.PHASE0,
(registry, specConfig) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void shouldSupportContinuousUntilHighestMilestone() {
void shouldSupportContinuousConstantWithUntil() {
final SchemaProvider<?> provider =
providerBuilder(STRING_SCHEMA_ID)
.constant(true)
.constant()
.withCreator(PHASE0, (r, c) -> "TestSchemaPhase0")
.withCreator(BELLATRIX, (r, c) -> "TestSchemaBellatrix")
.until(CAPELLA)
Expand Down Expand Up @@ -115,22 +115,6 @@ void shouldSupportContinuousDefaultVariable() {
.containsExactly(PHASE0, ALTAIR, BELLATRIX, CAPELLA);
}

@Test
void shouldAllowSingleMilestone() {
final SchemaProvider<?> provider =
providerBuilder(STRING_SCHEMA_ID)
.withCreator(ALTAIR, (r, c) -> "TestSchemaAltair")
.withCreator(BELLATRIX, (r, c) -> "TestSchemaBellatrix")
.until(CAPELLA)
.build();

when(mockRegistry.getMilestone()).thenReturn(DENEB);

assertThatThrownBy(() -> provider.getSchema(mockRegistry))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("It is not supposed to create a specific version for DENEB");
}

@Test
void shouldThrowWhenNoCreators() {
assertThatThrownBy(() -> providerBuilder(STRING_SCHEMA_ID).build())
Expand Down

0 comments on commit e69e1d6

Please sign in to comment.