1919import static org .assertj .core .api .Assertions .assertThat ;
2020
2121import com .exonum .binding .common .hash .HashCode ;
22- import com .exonum .binding .proxy .Cleaner ;
23- import com .exonum .binding .proxy .CloseFailuresException ;
24- import com .exonum .binding .storage .database .Database ;
25- import com .exonum .binding .storage .database .MemoryDb ;
26- import com .exonum .binding .storage .database .Snapshot ;
2722import com .exonum .binding .test .RequiresNativeLibrary ;
23+ import com .exonum .binding .testkit .TestKit ;
2824import com .exonum .binding .util .LibraryLoader ;
2925import java .util .List ;
3026import org .junit .jupiter .api .BeforeAll ;
@@ -39,20 +35,19 @@ static void loadLibrary() {
3935 }
4036
4137 @ Test
42- void getStateHashesEmptyDb () throws CloseFailuresException {
43- try (Database db = MemoryDb .newInstance ();
44- Cleaner cleaner = new Cleaner ()) {
45- Snapshot snapshot = db .createSnapshot (cleaner );
46- QaSchema schema = new QaSchema (snapshot );
38+ void getStateHashesEmptyDb () {
39+ try (TestKit testKit = TestKit .forService (QaServiceModule .class )) {
40+ testKit .withSnapshot ((view ) -> {
41+ QaSchema schema = new QaSchema (view );
4742
48- List <HashCode > stateHashes = schema .getStateHashes ();
43+ List <HashCode > stateHashes = schema .getStateHashes ();
4944
50- assertThat (stateHashes )
51- .hasSize (1 );
45+ assertThat (stateHashes ).hasSize (1 );
5246
53- HashCode countersRootHash = schema .counters ().getRootHash ();
54- assertThat (stateHashes .get (0 ))
55- .isEqualTo (countersRootHash );
47+ HashCode countersRootHash = schema .counters ().getRootHash ();
48+ assertThat (stateHashes .get (0 )).isEqualTo (countersRootHash );
49+ return null ;
50+ });
5651 }
5752 }
5853}
0 commit comments