Skip to content

Commit

Permalink
Added UT for PersistenceInjectionModule
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Aug 25, 2024
1 parent 99aa01f commit 1b2690c
Showing 1 changed file with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,50 @@

import static org.junit.jupiter.api.Assertions.*;

class PersistenceInjectionModuleTest {}
import com.hedera.block.server.config.BlockNodeContext;
import com.hedera.block.server.persistence.storage.PersistenceStorageConfig;
import com.hedera.block.server.persistence.storage.read.BlockReader;
import com.hedera.block.server.persistence.storage.write.BlockWriter;
import com.hedera.block.server.util.TestConfigUtil;
import com.hedera.hapi.block.stream.Block;
import com.hedera.hapi.block.stream.BlockItem;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
class PersistenceInjectionModuleTest {

@Mock private BlockNodeContext blockNodeContext;

@Mock private PersistenceStorageConfig persistenceStorageConfig;

@BeforeEach
void setup() throws IOException {
// Setup any necessary mocks before each test
blockNodeContext = TestConfigUtil.getTestBlockNodeContext();
persistenceStorageConfig =
blockNodeContext.configuration().getConfigData(PersistenceStorageConfig.class);
}

@Test
void testProvidesBlockWriter() {

BlockWriter<BlockItem> blockWriter =
PersistenceInjectionModule.providesBlockWriter(blockNodeContext);

assertNotNull(blockWriter);
}

@Test
void testProvidesBlockReader() {

BlockReader<Block> blockReader =
PersistenceInjectionModule.providesBlockReader(persistenceStorageConfig);

assertNotNull(blockReader);
}
}

0 comments on commit 1b2690c

Please sign in to comment.