### Question:
ServiceAdapter extends ManageableComponent { public void setDestination(Destination destination) { Destination oldDestination = getDestination(); setParent(destination); if (oldDestination != null) oldDestination.setAdapter(null); if (destination.getAdapter() != this) { destination.setAdapter(this); } } ServiceAdapter();  ServiceAdapter(boolean enableManagement); void start(); void stop(); Destination getDestination(); void setDestination(Destination destination); abstract Object invoke(Message message); Object manage(CommandMessage commandMessage); Object getAdapterState(); void setAdapterState(Object adapterState); boolean handlesSubscriptions(); static final String LOG_CATEGORY; }### Answer:
@Test public void testSetDestination() { destination = new MessageDestination(); adapter.setDestination(destination); Destination actual = adapter.getDestination(); Assert.assertEquals(destination, actual); ServiceAdapter actual2 = destination.getAdapter(); Assert.assertEquals(adapter, actual2); }
@Test public void testSetDestinationNull() { try { adapter.setDestination(null); Assert.fail("ConfigurationException expected"); } catch (ConfigurationException ce) { int error = 11116; Assert.assertEquals(ce.getNumber(), error); } }
@Test public void testSetDestinationWrongType() { destination = new Destination(); try { adapter.setDestination(destination); Assert.fail("ClassCastException expected"); } catch (ClassCastException e) { } }