Enquiry extends BaseModel { public boolean isValid() { int numberOfInternalFields = names().length(); for (Database.EnquiryTableColumn field : Database.EnquiryTableColumn.internalFields()) { if (has(field.getColumnName())) { numberOfInternalFields--; } } return numberOfInternalFields > 0; } Enquiry();  Enquiry(String content, String createdBy);  Enquiry(Cursor cursor);  Enquiry(String enquiryJSON); boolean isValid(); JSONObject values(); @Override List<BaseModel> getConfirmedMatchingModels(PotentialMatchRepository potentialMatchRepository, ChildRepository childRepository, EnquiryRepository enquiryRepository); @Override List<BaseModel> getPotentialMatchingModels(PotentialMatchRepository potentialMatchRepo, ChildRepository childRepository, EnquiryRepository enquiryRepository); static List<String> idsFromMatches(Collection<PotentialMatch> potentialMatches); @Override String getApiPath(); @Override String getApiParameter(); @Override String getRecordedAudio(); static final String ENQUIRY_FORM_NAME; static final String FIELD_ATTACHMENTS; }
@Test public void shouldBeValidEnquiry() throws JSONException { String enquiryJSON = "{\"enquirer_name\":\"sam fisher\", \"name\":\"foo bar\", \"nationality\":\"ugandan\"}"; Enquiry enquiry = new Enquiry(enquiryJSON); Assert.assertTrue(enquiry.isValid()); }
@Test public void shouldNotBeValidEnquiry() throws JSONException { String enquiryJSON = "{}"; Enquiry enquiry = new Enquiry(enquiryJSON); Assert.assertFalse(enquiry.isValid()); }