19
19
import static org .assertj .core .api .Assertions .assertThat ;
20
20
21
21
import 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 ;
27
22
import com .exonum .binding .test .RequiresNativeLibrary ;
23
+ import com .exonum .binding .testkit .TestKit ;
28
24
import com .exonum .binding .util .LibraryLoader ;
29
25
import java .util .List ;
30
26
import org .junit .jupiter .api .BeforeAll ;
@@ -39,20 +35,19 @@ static void loadLibrary() {
39
35
}
40
36
41
37
@ 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 );
47
42
48
- List <HashCode > stateHashes = schema .getStateHashes ();
43
+ List <HashCode > stateHashes = schema .getStateHashes ();
49
44
50
- assertThat (stateHashes )
51
- .hasSize (1 );
45
+ assertThat (stateHashes ).hasSize (1 );
52
46
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
+ });
56
51
}
57
52
}
58
53
}
0 commit comments