AbstractRouteRegistry implements RouteRegistry { @Override public void removeRoute(Class<? extends Component> navigationTarget) { if (!getConfiguration().hasRouteTarget(navigationTarget)) { return; } configure(configuration -> configuration.removeRoute(navigationTarget)); }  @Override void update(Command command); @Override Registration addRoutesChangeListener(
            RoutesChangedListener listener); ConfiguredRoutes getConfiguration(); @Override List<RouteData> getRegisteredRoutes(); @Override @Deprecated List<Class<? extends RouterLayout>> getRouteLayouts(String path,
            Class<? extends Component> navigationTarget); @Override Optional<String> getTargetUrl(
            Class<? extends Component> navigationTarget); @Override Optional<String> getTargetUrl(
            Class<? extends Component> navigationTarget,
            RouteParameters parameters); @Override Optional<String> getTemplate(
            Class<? extends Component> navigationTarget); @Override void setRoute(String path,
            Class<? extends Component> navigationTarget,
            List<Class<? extends RouterLayout>> parentChain); @Override void removeRoute(Class<? extends Component> navigationTarget); @Override void removeRoute(String path); @Override void removeRoute(String path,
            Class<? extends Component> navigationTarget); @Override void clean();  }
@Test public void removing_target_leaves_others() { addTarget(NormalRoute.class); addTarget(HasUrlRoute.class); addTarget(WildcardRoute.class); Assert.assertEquals("Expected three routes to be registered", 3, config().getTargetRoutes().size()); registry.removeRoute(HasUrlRoute.class); Assert.assertEquals("Only 2 routes should remain after removing one.", 2, config().getTargetRoutes().size()); Assert.assertTrue("NormalRoute should still be available", config().hasRouteTarget(NormalRoute.class)); Assert.assertTrue("WildcardRoute should still be available", config().hasRouteTarget(WildcardRoute.class)); }
@Test public void removing_all_targets_is_possible_and_returns_empty() { addTarget(NormalRoute.class); addTarget(HasUrlRoute.class); addTarget(WildcardRoute.class); Assert.assertEquals("Expected three routes to be registered", 3, config().getTargetRoutes().size()); registry.removeRoute(HasUrlRoute.class); registry.removeRoute(NormalRoute.class); registry.removeRoute(WildcardRoute.class); Assert.assertTrue( "All routes should have been removed from the target.", config().getTargetRoutes().isEmpty()); }