/** Accuracy test of the <code>createAnySubmissionIdFilter(long[])</code> method. */ public void testMethod_createAnySubmissionIdFilter() { long[] submissionIds = {1, 2, 3}; Filter filter = ResourceFilterBuilder.createAnySubmissionIdFilter(submissionIds); // check null here. assertNotNull("Create AnySubmissionIdFilter failed.", filter); if (filter instanceof InFilter) { assertTrue("The num of filter is equal to 3.", ((InFilter) filter).getList().size() == 3); } else if (filter instanceof OrFilter) { assertTrue("The num of filter is equal to 3.", ((OrFilter) filter).getFilters().size() == 3); } else { fail("AnySubmissionIdFilter type is incorrect."); } }
/** Accuracy test of the <code>createPhaseIdFilter(long)</code> method. */ public void testMethod_createPhaseIdFilter() { long phaseId = 1; Filter filter = ResourceFilterBuilder.createPhaseIdFilter(phaseId); // check null here. assertNotNull("Create PhaseIdFilter failed.", filter); // check the type here. assertTrue("The 'PhaseIdFilter' should extend EqualToFilter.", filter instanceof EqualToFilter); // check the filter's name here. assertEquals( "The name of filter is incorrect.", ResourceFilterBuilder.PHASE_ID_FIELD_NAME, ((EqualToFilter) filter).getName()); // check the filter's value here. assertEquals( "The value of filter is incorrect.", phaseId, ((Long) ((EqualToFilter) filter).getValue()).longValue()); }
/** Accuracy test of the <code>createExtensionPropertyValueFilter(String)</code> method. */ public void testMethod_createExtensionPropertyValueFilter() { String value = "tc"; Filter filter = ResourceFilterBuilder.createExtensionPropertyValueFilter(value); // check null here. assertNotNull("Create ExtensionPropertyValueFilter failed.", filter); // check the type here. assertTrue( "The 'ExtensionPropertyValueFilter' should extend EqualToFilter.", filter instanceof EqualToFilter); // check the filter's name here. assertEquals( "The name of filter is incorrect.", ResourceFilterBuilder.EXTENSION_PROPERTY_VALUE_FIELD_NAME, ((EqualToFilter) filter).getName()); // check the filter's value here. assertEquals( "The value of filter is incorrect.", value, ((String) ((EqualToFilter) filter).getValue())); }
/** Accuracy test of the <code>createSubmissionIdFilter(long)</code> method. */ public void testMethod_createSubmissionIdFilter() { long submissionId = Long.MAX_VALUE; Filter filter = ResourceFilterBuilder.createSubmissionIdFilter(submissionId); // check null here. assertNotNull("Create SubmissionIdFilter failed.", filter); // check the type here. assertTrue( "The 'SubmissionIdFilter' should extend EqualToFilter.", filter instanceof EqualToFilter); // check the filter's name here. assertEquals( "The name of filter is incorrect.", ResourceFilterBuilder.SUBMISSION_ID_FIELD_NAME, ((EqualToFilter) filter).getName()); // check the filter's value here. assertEquals( "The value of filter is incorrect.", submissionId, ((Long) ((EqualToFilter) filter).getValue()).longValue()); }