NegativeBoundHiveDate extends BoundaryDate<NegativeBoundHiveDate.NegativeBoundHiveDateTag> { public List<Map<String, String>> pipelinePossibleStates(NegativeBoundHiveDateTag action, List<Map<String, String>> possibleStateList) { return returnStates(action, possibleStateList, setParameters(action, false)); }  Class<NegativeBoundHiveDateTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(NegativeBoundHiveDateTag action, List<Map<String, String>> possibleStateList);  }
@Test public void leapYearTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); NegativeBoundHiveDate dateTest = new NegativeBoundHiveDate(); NegativeBoundHiveDate.NegativeBoundHiveDateTag tag = new NegativeBoundHiveDate.NegativeBoundHiveDateTag(); tag.setName("name"); tag.setEarliest("2016-03-01"); tag.setLatest("2016-02-28"); List<Map<String, String>> newList = dateTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), "2016-02-29"); Assert.assertEquals(newList.get(1).get("name"), "2016-02-29"); }
@Test public void lowerBoundTest2() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); NegativeBoundHiveDate dateTest = new NegativeBoundHiveDate(); NegativeBoundHiveDate.NegativeBoundHiveDateTag tag = new NegativeBoundHiveDate.NegativeBoundHiveDateTag(); tag.setName("name"); Calendar nextDate = Calendar.getInstance(); nextDate.add(Calendar.DATE, +1); String next = new SimpleDateFormat("yyyy-MM-dd").format(nextDate.getTime()); String day = next.substring(8, 10); String month = next.substring(5, 7); String year = next.substring(0, 4); List<Map<String, String>> newList = dateTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), "1969-12-31"); Assert.assertEquals(newList.get(1).get("name"), next); Assert.assertEquals(newList.get(2).get("name"), month + "-" + day + "-" + year); }
@Test public void dateTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); NegativeBoundHiveDate dateTest = new NegativeBoundHiveDate(); NegativeBoundHiveDate.NegativeBoundHiveDateTag tag = new NegativeBoundHiveDate.NegativeBoundHiveDateTag(); tag.setName("name"); tag.setEarliest("2012-12-31"); tag.setLatest("2014-01-01"); List<Map<String, String>> newList = dateTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), "2012-12-30"); Assert.assertEquals(newList.get(1).get("name"), "2014-01-02"); Assert.assertEquals(newList.get(2).get("name"), "01-02-2014"); Assert.assertEquals(newList.size(), 4); }