### Question:
ChangeRangeFacetGetter implements FacetGetter { @Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { long lowerLimit = 0; long upperLimit = 0; for (String key : values.keySet()) { try { LocalDate localDate = getChangeLocalDate(key); long dateStamp = Long.valueOf(FORMATTER.format(localDate)); if (dateStamp > upperLimit) { upperLimit = dateStamp; } if (lowerLimit == 0 || dateStamp < lowerLimit) { lowerLimit = dateStamp; } } catch (IOException e) { LOG.error("'{}' is not a valid change.", key); } } return new Facet(facetName, Lists.newArrayList(new Facet.RangeOption(lowerLimit, upperLimit)), "RANGE"); }  @Override Facet getFacet(String facetName, Map<String, Set<Vertex>> values); static final DateTimeFormatter FORMATTER; static final Logger LOG; }### Answer:
@Test public void getFacetReturnsLowerAndUpperLimitAsZeroWhenValueKeyIsNotParsableAsModifiedProp() { FacetGetter instance = new ChangeRangeFacetGetter(); Map<String, Set<Vertex>> values = Maps.newHashMap(); List<Vertex> vertices1 = newGraph() .withVertex(v -> v.withTimId("1")) .withVertex(v -> v.withTimId("2")) .build().traversal().V().toList(); List<Vertex> vertices2 = newGraph() .withVertex(v -> v.withTimId("3")) .build().traversal().V().toList(); values.put("val1", Sets.newHashSet(vertices1)); values.put("val2", Sets.newHashSet(vertices2)); Facet facet = instance.getFacet(FACET_NAME, values); assertThat(facet.getName(), equalTo(FACET_NAME)); assertThat(facet.getOptions(), containsInAnyOrder(new Facet.RangeOption(0, 0))); }
@Test public void getFacetReturnsLowerAndUpperLimit() { FacetGetter instance = new ChangeRangeFacetGetter(); Map<String, Set<Vertex>> values = Maps.newHashMap(); List<Vertex> vertices1 = newGraph() .withVertex(v -> v.withTimId("1")) .withVertex(v -> v.withTimId("2")) .build().traversal().V().toList(); List<Vertex> vertices2 = newGraph() .withVertex(v -> v.withTimId("3")) .build().traversal().V().toList(); values.put(serializedChangeWithDate("20150101"), Sets.newHashSet(vertices1)); values.put("{\"nonParsable\": null}", Sets.newHashSet(vertices1)); values.put(serializedChangeWithDate("20121231"), Sets.newHashSet(vertices2)); values.put(serializedChangeWithDate("20131231"), Sets.newHashSet(vertices2)); Facet facet = instance.getFacet(FACET_NAME, values); assertThat(facet.getName(), equalTo(FACET_NAME)); assertThat(facet.getOptions(), containsInAnyOrder(new Facet.RangeOption(20121231, 20150101))); }