@Test(expected = InvalidUserSearchCriteriaException.class) public void test_should_throw_exception_when_tenant_id_is_not_present() { final UserSearchCriteria searchCriteria = UserSearchCriteria.builder() .tenantId(null) .build(); searchCriteria.validate(true); }
public void validate(boolean isInterServiceCall) { if (validateIfEmptySearch(isInterServiceCall) || validateIfTenantIdExists(isInterServiceCall)) { throw new InvalidUserSearchCriteriaException(this); } }
UserSearchCriteria { public void validate(boolean isInterServiceCall) { if (validateIfEmptySearch(isInterServiceCall) || validateIfTenantIdExists(isInterServiceCall)) { throw new InvalidUserSearchCriteriaException(this); } } }
UserSearchCriteria { public void validate(boolean isInterServiceCall) { if (validateIfEmptySearch(isInterServiceCall) || validateIfTenantIdExists(isInterServiceCall)) { throw new InvalidUserSearchCriteriaException(this); } }  }
UserSearchCriteria { public void validate(boolean isInterServiceCall) { if (validateIfEmptySearch(isInterServiceCall) || validateIfTenantIdExists(isInterServiceCall)) { throw new InvalidUserSearchCriteriaException(this); } }  void validate(boolean isInterServiceCall); }
UserSearchCriteria { public void validate(boolean isInterServiceCall) { if (validateIfEmptySearch(isInterServiceCall) || validateIfTenantIdExists(isInterServiceCall)) { throw new InvalidUserSearchCriteriaException(this); } }  void validate(boolean isInterServiceCall);  }