@Test public void shouldBeAbletoQueryForExactMatch() throws UnauthorizedException, RemoteRequestException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (testLiveBackend == null) return; if (testLiveBackend != null && !testLiveBackend.equals("yes")) { return; } Map<String, String> params = new HashMap<String, String>(); com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote obj = new com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote(); obj.save(); obj.reload(); params.put("requested_on", obj.getRequestedOn().toString()); createdObjects = new ArrayList< com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote>(); createdObjects.add(obj); List<com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote> objects = com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote .query("exact_match", params, null, null); Assert.assertEquals(1, objects.size()); }
@Test public void shouldBeAbletoQueryForAll() throws UnauthorizedException, RemoteRequestException { if (testLiveBackend == null) return; if (testLiveBackend != null && !testLiveBackend.equals("yes")) { return; } createdObjects = new ArrayList< com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote>(); // Create some entities. for (int i = 0; i < MAX_ENTITIES; i++) { com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote obj = new com.anypresence.sdk.citi_mobile_challenge.models .CorporatePaymentsCrossBorderFxQuote(); obj.save(); createdObjects.add(obj); } List<com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote> objects = com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote .query("all"); Assert.assertTrue(objects.size() >= MAX_ENTITIES); // Test limiting result. objects = com.anypresence.sdk.citi_mobile_challenge.models.CorporatePaymentsCrossBorderFxQuote.query( "all", null, 0, 2); Assert.assertEquals(2, objects.size()); }