use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test009putAndGetHeaderOfBlockWithMaxIndex.
/**
* test put, and getFullBlockFromHash.
*/
@Test
public void test009putAndGetHeaderOfBlockWithMaxIndex() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock001();
controller.getBlockDb().put(true, expectedBlock);
expectedBlock.getTransactionList().clear();
final Block actualBlock = controller.getBlockDb().getHeaderOfBlockWithMaxIndex();
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test004getHeaderOfBlockWithMaxIndex.
/**
* test getHeaderOfBlockWithMaxIndex.
*/
@Test
public void test004getHeaderOfBlockWithMaxIndex() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block actual = controller.getBlockDb().getHeaderOfBlockWithMaxIndex();
Assert.assertEquals("getHeaderOfBlockWithMaxIndex should return null with empty db.", null, actual);
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test005putAndGetFullBlockFromHeight.
/**
* test put, and getFullBlockFromHeight.
*/
@Test
public void test005putAndGetFullBlockFromHeight() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock001();
controller.getBlockDb().put(true, expectedBlock);
final Block actualBlock = controller.getBlockDb().getFullBlockFromHeight(0);
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test010putAndGetHeaderOfBlockFromHeight.
/**
* test put, and getHeaderOfBlockFromHeight.
*/
@Test
public void test010putAndGetHeaderOfBlockFromHeight() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock001();
controller.getBlockDb().put(true, expectedBlock);
expectedBlock.getTransactionList().clear();
final Block actualBlock = controller.getBlockDb().getHeaderOfBlockFromHeight(0);
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
use of neo.model.core.Block in project neo-java by coranos.
the class TestDBH2 method test011putAndGetHeaderOfBlockFromHash.
/**
* test put, and getHeaderOfBlockFromHash.
*/
@Test
public void test011putAndGetHeaderOfBlockFromHash() {
try (TestLocalControllerNode controller = getTestLocalControllerNode()) {
final Block expectedBlock = MockUtil.getMockBlock001();
controller.getBlockDb().put(true, expectedBlock);
expectedBlock.getTransactionList().clear();
final Block actualBlock = controller.getBlockDb().getHeaderOfBlockFromHash(expectedBlock.hash);
Assert.assertEquals("blocks should match.", expectedBlock.toString(), actualBlock.toString());
}
}
Aggregations