1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
8 import org
.junit
.ClassRule
;
11 import static org
.assertj
.core
.api
.Assertions
.assertThat
;
13 public class ComparatorOptionsTest
{
16 public static final RocksNativeLibraryResource ROCKS_NATIVE_LIBRARY_RESOURCE
=
17 new RocksNativeLibraryResource();
20 public void reusedSynchronisationType() {
21 try(final ComparatorOptions copt
= new ComparatorOptions()) {
23 copt
.setReusedSynchronisationType(ReusedSynchronisationType
.MUTEX
);
24 assertThat(copt
.reusedSynchronisationType())
25 .isEqualTo(ReusedSynchronisationType
.MUTEX
);
27 copt
.setReusedSynchronisationType(ReusedSynchronisationType
.ADAPTIVE_MUTEX
);
28 assertThat(copt
.reusedSynchronisationType())
29 .isEqualTo(ReusedSynchronisationType
.ADAPTIVE_MUTEX
);
31 copt
.setReusedSynchronisationType(ReusedSynchronisationType
.THREAD_LOCAL
);
32 assertThat(copt
.reusedSynchronisationType())
33 .isEqualTo(ReusedSynchronisationType
.THREAD_LOCAL
);
38 public void useDirectBuffer() {
39 try(final ComparatorOptions copt
= new ComparatorOptions()) {
40 copt
.setUseDirectBuffer(true);
41 assertThat(copt
.useDirectBuffer()).isTrue();
43 copt
.setUseDirectBuffer(false);
44 assertThat(copt
.useDirectBuffer()).isFalse();
49 public void maxReusedBufferSize() {
50 try(final ComparatorOptions copt
= new ComparatorOptions()) {
51 copt
.setMaxReusedBufferSize(12345);
52 assertThat(copt
.maxReusedBufferSize()).isEqualTo(12345);
54 copt
.setMaxReusedBufferSize(-1);
55 assertThat(copt
.maxReusedBufferSize()).isEqualTo(-1);