DirectDispatchOven extends Oven { @Override public void setDefaultDispatcher(Dispatcher dispatcher) { throw new UnsupportedOperationException( "cannot overwrite default dispatcher in DirectDispatchOven"); } DirectDispatchOven(BackendOven backendOven); @Override void setDefaultDispatcher(Dispatcher dispatcher); @Override void addDispatcher(String domain, Dispatcher dispatcher);  }
@Test(expected = UnsupportedOperationException.class) public void testSetDefaultDispatcher_throws() { Oven oven = new DirectDispatchOven(new BackendOven()); oven.setDefaultDispatcher(payload -> "{}"); }