From 4350670347da3b4bca890ec800d5103c275690f8 Mon Sep 17 00:00:00 2001 From: Atanas Atanasov Date: Thu, 12 Dec 2024 16:31:58 +0200 Subject: [PATCH] another test for compression types Signed-off-by: Atanas Atanasov --- .../storage/PersistenceStorageConfigTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/src/test/java/com/hedera/block/server/persistence/storage/PersistenceStorageConfigTest.java b/server/src/test/java/com/hedera/block/server/persistence/storage/PersistenceStorageConfigTest.java index cdd0309d..8314235d 100644 --- a/server/src/test/java/com/hedera/block/server/persistence/storage/PersistenceStorageConfigTest.java +++ b/server/src/test/java/com/hedera/block/server/persistence/storage/PersistenceStorageConfigTest.java @@ -159,6 +159,20 @@ void testPersistenceStorageConfigInvalidCompressionLevel(final int compressionLe "", "", StorageType.BLOCK_AS_LOCAL_FILE, CompressionType.ZSTD, compressionLevel)); } + /** + * This test aims to verify that the {@link PersistenceStorageConfig} class + * correctly returns the compression type that was set in the constructor. + * + * @param compressionType parameterized, the compression type to test + */ + @ParameterizedTest + @MethodSource("compressionTypes") + void testPersistenceStorageConfigCompressionTypes(final CompressionType compressionType) { + final PersistenceStorageConfig actual = + new PersistenceStorageConfig("", "", StorageType.NO_OP, compressionType, DEFAULT_COMPRESSION_LEVEL); + assertThat(actual).returns(compressionType, from(PersistenceStorageConfig::compression)); + } + /** * All storage types dynamically provided. */ @@ -166,6 +180,13 @@ private static Stream storageTypes() { return Arrays.stream(StorageType.values()).map(Arguments::of); } + /** + * All compression types dynamically provided. + */ + private static Stream compressionTypes() { + return Arrays.stream(CompressionType.values()).map(Arguments::of); + } + /** * The default absolute paths. We expect these to allow the persistence * config to be instantiated. Providing a blank string is accepted, it will