From e69e1d6c4175625e6a2ba2d24e3d19b437535be1 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Mon, 14 Oct 2024 15:01:02 +0200 Subject: [PATCH] apply suggestions --- .../schemas/registry/BaseSchemaProvider.java | 4 ++-- .../registry/SchemaRegistryBuilder.java | 4 ++-- .../registry/BaseSchemaProviderTest.java | 18 +----------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProvider.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProvider.java index 543a9ff2d78..95eeceda456 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProvider.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProvider.java @@ -134,8 +134,8 @@ public Builder until(final SpecMilestone untilMilestone) { return this; } - public Builder constant(final boolean isConstant) { - this.isConstant = isConstant; + public Builder constant() { + this.isConstant = true; return this; } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java index 07947be9225..ddf5971ebf1 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/schemas/registry/SchemaRegistryBuilder.java @@ -45,7 +45,7 @@ public static SchemaRegistryBuilder create() { private static SchemaProvider> createAttnetsENRFieldSchemaProvider() { return providerBuilder(ATTNETS_ENR_FIELD_SCHEMA) - .constant(true) + .constant() .withCreator( SpecMilestone.PHASE0, (registry, specConfig) -> @@ -55,7 +55,7 @@ public static SchemaRegistryBuilder create() { private static SchemaProvider> createAttestationSchemaProvider() { return providerBuilder(ATTESTATION_SCHEMA) - .constant(true) + .constant() .withCreator( SpecMilestone.PHASE0, (registry, specConfig) -> diff --git a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProviderTest.java b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProviderTest.java index 6d03d40c7e5..54a5196219f 100644 --- a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProviderTest.java +++ b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/schemas/registry/BaseSchemaProviderTest.java @@ -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) @@ -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())