@@ -120,6 +120,78 @@ void close() {
120120 .isInstanceOf (ConstantDerivedException .class );
121121 }
122122
123+ @ Test
124+ void constructorArgsNullEnv () {
125+ assertThatThrownBy (
126+ () -> {
127+ try (Txn <ByteBuffer > txn = env .txnWrite ()) {
128+ new Dbi <>(
129+ null ,
130+ txn ,
131+ "foo" .getBytes (Env .DEFAULT_NAME_CHARSET ),
132+ PROXY_OPTIMAL ,
133+ DbiFlagSet .EMPTY );
134+ }
135+ })
136+ .isInstanceOf (NullPointerException .class );
137+ }
138+
139+ @ Test
140+ void constructorArgsNullTxn () {
141+ assertThatThrownBy (
142+ () -> {
143+ new Dbi <>(
144+ env ,
145+ null ,
146+ "foo" .getBytes (Env .DEFAULT_NAME_CHARSET ),
147+ PROXY_OPTIMAL ,
148+ DbiFlagSet .EMPTY );
149+ })
150+ .isInstanceOf (NullPointerException .class );
151+ }
152+
153+ @ Test
154+ void constructorArgsNullProxy () {
155+ assertThatThrownBy (
156+ () -> {
157+ try (Txn <ByteBuffer > txn = env .txnWrite ()) {
158+ new Dbi <>(
159+ env , txn , "foo" .getBytes (Env .DEFAULT_NAME_CHARSET ), null , DbiFlagSet .EMPTY );
160+ }
161+ })
162+ .isInstanceOf (NullPointerException .class );
163+ }
164+
165+ @ Test
166+ void constructorArgsNullFlags () {
167+ assertThatThrownBy (
168+ () -> {
169+ try (Txn <ByteBuffer > txn = env .txnWrite ()) {
170+ new Dbi <>(env , txn , "foo" .getBytes (Env .DEFAULT_NAME_CHARSET ), PROXY_OPTIMAL , null );
171+ }
172+ })
173+ .isInstanceOf (NullPointerException .class );
174+ }
175+
176+ @ Test
177+ void constructorArgsNullNativeCallbackComparator () {
178+ assertThatThrownBy (
179+ () -> {
180+ try (Txn <ByteBuffer > txn = env .txnWrite ()) {
181+ new Dbi <>(
182+ env ,
183+ txn ,
184+ "foo" .getBytes (Env .DEFAULT_NAME_CHARSET ),
185+ null ,
186+ true ,
187+ PROXY_OPTIMAL ,
188+ DbiFlagSet .EMPTY );
189+ }
190+ })
191+ .isInstanceOf (IllegalArgumentException .class )
192+ .hasMessageContaining ("Is nativeCb is true, you must supply a comparator" );
193+ }
194+
123195 @ Test
124196 void customComparator () {
125197 final Comparator <ByteBuffer > reverseOrder =
0 commit comments