@@ -221,6 +221,88 @@ public void testFindInt_uniqueFails() {
221
221
box .query ().build ().property (simpleInt ).unique ().findInt ();
222
222
}
223
223
224
+ @ Test
225
+ public void testFindShort () {
226
+ Query <TestEntity > query = box .query ().greater (simpleLong , 1002 ).build ();
227
+ assertNull (query .property (simpleShort ).findShort ());
228
+ assertNull (query .property (simpleShort ).unique ().findShort ());
229
+
230
+ putTestEntities (5 );
231
+ assertEquals (103 , (short ) query .property (simpleShort ).findShort ());
232
+
233
+ query = box .query ().greater (simpleLong , 1004 ).build ();
234
+ assertEquals (105 , (short ) query .property (simpleShort ).distinct ().unique ().findShort ());
235
+ }
236
+
237
+ @ Test (expected = DbException .class )
238
+ public void testFindShort_uniqueFails () {
239
+ putTestEntity (null , 1 );
240
+ putTestEntity (null , 1 );
241
+ box .query ().build ().property (simpleShort ).unique ().findShort ();
242
+ }
243
+
244
+ // TODO add test for findChar
245
+
246
+ @ Test
247
+ public void testFindByte () {
248
+ Query <TestEntity > query = box .query ().greater (simpleLong , 1002 ).build ();
249
+ assertNull (query .property (simpleByte ).findByte ());
250
+ assertNull (query .property (simpleByte ).unique ().findByte ());
251
+
252
+ putTestEntities (5 );
253
+ assertEquals ((byte ) 13 , (byte ) query .property (simpleByte ).findByte ());
254
+
255
+ query = box .query ().greater (simpleLong , 1004 ).build ();
256
+ assertEquals ((byte ) 15 , (byte ) query .property (simpleByte ).distinct ().unique ().findByte ());
257
+ }
258
+
259
+ @ Test (expected = DbException .class )
260
+ public void testFindByte_uniqueFails () {
261
+ putTestEntity (null , 1 );
262
+ putTestEntity (null , 1 );
263
+ box .query ().build ().property (simpleByte ).unique ().findByte ();
264
+ }
265
+
266
+ @ Test
267
+ public void testFindBoolean () {
268
+ Query <TestEntity > query = box .query ().greater (simpleLong , 1002 ).build ();
269
+ assertNull (query .property (simpleBoolean ).findBoolean ());
270
+ assertNull (query .property (simpleBoolean ).unique ().findBoolean ());
271
+
272
+ putTestEntities (5 );
273
+ assertFalse (query .property (simpleBoolean ).findBoolean ());
274
+
275
+ query = box .query ().greater (simpleLong , 1004 ).build ();
276
+ assertFalse (query .property (simpleBoolean ).distinct ().unique ().findBoolean ());
277
+ }
278
+
279
+ @ Test (expected = DbException .class )
280
+ public void testFindBoolean_uniqueFails () {
281
+ putTestEntity (null , 1 );
282
+ putTestEntity (null , 1 );
283
+ box .query ().build ().property (simpleBoolean ).unique ().findBoolean ();
284
+ }
285
+
286
+ @ Test
287
+ public void testFindFloat () {
288
+ Query <TestEntity > query = box .query ().greater (simpleLong , 1002 ).build ();
289
+ assertNull (query .property (simpleFloat ).findFloat ());
290
+ assertNull (query .property (simpleFloat ).unique ().findFloat ());
291
+
292
+ putTestEntities (5 );
293
+ assertEquals (200.3f , query .property (simpleFloat ).findFloat (), 0.001f );
294
+
295
+ query = box .query ().greater (simpleLong , 1004 ).build ();
296
+ assertEquals (200.5f , query .property (simpleFloat ).distinct ().unique ().findFloat (), 0.001f );
297
+ }
298
+
299
+ @ Test (expected = DbException .class )
300
+ public void testFindFloat_uniqueFails () {
301
+ putTestEntity (null , 1 );
302
+ putTestEntity (null , 1 );
303
+ box .query ().build ().property (simpleFloat ).unique ().findFloat ();
304
+ }
305
+
224
306
@ Test
225
307
public void testFindDouble () {
226
308
Query <TestEntity > query = box .query ().greater (simpleLong , 1002 ).build ();
@@ -233,7 +315,12 @@ public void testFindDouble() {
233
315
assertEquals (2000.05 , query .property (simpleDouble ).distinct ().unique ().findDouble (), 0.001 );
234
316
}
235
317
236
- // TODO add test for other types of single object find methods
318
+ @ Test (expected = DbException .class )
319
+ public void testFindDouble_uniqueFails () {
320
+ putTestEntity (null , 1 );
321
+ putTestEntity (null , 1 );
322
+ box .query ().build ().property (simpleDouble ).unique ().findDouble ();
323
+ }
237
324
238
325
@ Test
239
326
public void testFindInts () {
0 commit comments