protected void squashDuplicateRoutes() {

        Map<String, String> squashMap = new TreeMap<>();

        // create a map using the 'from' URI as the key to eliminate duplicates
        routeMap.forEach((key, route) -> {
            Map<String, Object> from = (Map<String, Object>) route.getComponentsMap().get(FROM);
            String uri = from.get(URI).toString();
            squashMap.put(uri, key);
        });

        // use the de-duplicated URIs to create a route map with unique routes, regardless of the ID
        Map<String, Route> squashedRouteMap = new TreeMap<>();
        squashMap.forEach((key, value) -> squashedRouteMap.put(value, routeMap.get(value)));

        routeMap.clear();
        routeMap.putAll(squashedRouteMap);
    }
@Test
    public void testSquashDuplicateRoutes() throws IllegalAccessException {

        @SuppressWarnings("unchecked")
        Map<String, Route> result = (Map<String, Route>) FieldUtils.readDeclaredField(processor, "routeMap", true);

        result.clear();
        result.put("route1", TestUtil.route());
        result.put("route2", TestUtil.route());

        assertAll(
                () -> assertNotNull(result),
                () -> assertEquals(2, result.size()));

        processor.squashDuplicateRoutes();

        assertAll(
                () -> assertNotNull(result),
                () -> assertEquals(1, result.size()));
    }