### Question:
JmsTopic extends JmsDestination implements Topic { @Override public String getTopicName() { return getAddress(); } JmsTopic();  JmsTopic(String name); @Override String getTopicName();  }### Answer:
@Test public void testSetPropertiesWithUnusedOptions() throws Exception { String name = "myTopic"; String unusedKey = "unusedKey"; String unusedValue = "unusedValue"; JmsTopic topic = new JmsTopic(); Map<String, String> props = new HashMap<String, String>(); props.put(NAME_PROP, name); props.put(unusedKey, unusedValue); Map<String, String> unusedProps = topic.setProperties(props); assertEquals("Unexpected value for name", name, topic.getTopicName()); assertEquals("Unexpected size of return map", 1, unusedProps.size()); assertTrue("Expected property not found in map: " + unusedProps, unusedProps.containsKey(unusedKey)); assertEquals("Unexpected property value", unusedValue, unusedProps.get(unusedKey)); try { unusedProps.put("a", "b"); fail("Map should be unmodifiable"); } catch (UnsupportedOperationException uoe) { } }
@Test public void testSerializeThenDeserialize() throws Exception { String name = "myTopic"; JmsTopic topic = new JmsTopic(name); Object roundTripped = roundTripSerialize(topic); assertNotNull("Null destination returned", roundTripped); assertEquals("Unexpected type", JmsTopic.class, roundTripped.getClass()); assertEquals("Unexpected name", name, ((JmsTopic)roundTripped).getTopicName()); assertEquals("Objects were not equal", topic, roundTripped); assertEquals("Object hashCodes were not equal", topic.hashCode(), roundTripped.hashCode()); }