TrimmingPostProcessor implements PostProcessor { @Override public void postProcess( Map<String, KlvDataElement> dataElements, Map<String, KlvHandler> handlers) { notNull(handlers, "handlers must be non-null"); handlers.values().stream() .distinct() .filter(Trimmable.class::isInstance) .map(Trimmable.class::cast) .forEach(Trimmable::trim); }  @Override void postProcess(
      Map<String, KlvDataElement> dataElements, Map<String, KlvHandler> handlers);  }
@Test public void testPostProcess() throws KlvDecodingException { TrimmingPostProcessor trimmingPostProcessor = new TrimmingPostProcessor(); KlvHandler klvHandler = mock(KlvHandler.class, withSettings().extraInterfaces(Trimmable.class)); trimmingPostProcessor.postProcess( Collections.emptyMap(), Collections.singletonMap("field", klvHandler)); verify((Trimmable) klvHandler).trim(); }