### Question:
HQLBuilder { public StringBuilder dateBoundary(StringBuilder hqlBuilder, String field, String startDate, String endDate) { if(hqlBuilder.toString().contains("where")) { hqlBuilder.append("and(").append(SPACE); } else { hqlBuilder.append("where(").append(SPACE); } hqlBuilder.append(field).append(SPACE); hqlBuilder.append(">=").append(SPACE); hqlBuilder.append(startDate).append(SPACE); hqlBuilder.append("and").append(SPACE); hqlBuilder.append(field).append(SPACE); hqlBuilder.append("<").append(SPACE); hqlBuilder.append(endDate).append(")").append(SPACE); return hqlBuilder; }  StringBuilder from(StringBuilder hqlBuilder, String entity, String alias); StringBuilder from(StringBuilder hqlBuilder, String entity); StringBuilder where(StringBuilder hqlBuilder, String field, String value); StringBuilder where(StringBuilder hqlBuilder, String alias, String field, String value); StringBuilder order(StringBuilder hqlBuilder, String field, String order); StringBuilder order(StringBuilder hqlBuilder, String alias, String field, String order); StringBuilder join(StringBuilder hqlBuilder, String primaryAlias, String secondaryAlias, 
			String joinColumn); StringBuilder dateBoundary(StringBuilder hqlBuilder, String field, String startDate, 
			String endDate); StringBuilder dateBoundary(StringBuilder hqlBuilder, String alias, String field,
			String startDate, String endDate);  }### Answer:
@Test public void testDateBoundary() throws ParseException { queryBuilder = new HQLBuilder(); StringBuilder hql = queryBuilder.from(new StringBuilder(), "CcAndInferredLocationRecord", "cc"); hql = queryBuilder.from(hql, "ArchivedInferredLocationRecord", "in"); hql = queryBuilder.where(hql, "cc", "vehicleId", ":vehicleId"); hql = queryBuilder.where(hql, "cc", "vehicleAgencyId", ":vehicleAgencyId"); hql = queryBuilder.dateBoundary(hql, "cc", "timeReported", ":startDate", ":endDate"); hql = queryBuilder.join(hql, "cc", "in", "vehicleId"); hql = queryBuilder.order(hql, "cc", "vehicleId", "desc"); assertEquals("Expecting well formed hql", "from CcAndInferredLocationRecord cc ," + "ArchivedInferredLocationRecord in where cc.vehicleId= :vehicleId" + " and cc.vehicleAgencyId= :vehicleAgencyId and( cc.timeReported >= :startDate and " + "cc.timeReported < :endDate)" + " and cc.vehicleId = in.vehicleId " + "order by cc.vehicleId desc ", hql.toString()); }