### Question:
InstanceIdentifierCodec extends AbstractModuleStringInstanceIdentifierCodec implements EffectiveModelContextListener { @Override protected Module moduleForPrefix(final String prefix) { return context.findModules(prefix).stream().findFirst().orElse(null); } InstanceIdentifierCodec(DOMSchemaService schemaService,
            BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer); @Override void onModelContextUpdated(EffectiveModelContext schemaContext); String serialize(InstanceIdentifier<?> iid); YangInstanceIdentifier getYangInstanceIdentifier(InstanceIdentifier<?> iid); InstanceIdentifier<?> bindingDeserializer(String iidString); InstanceIdentifier<?> bindingDeserializer(YangInstanceIdentifier yangIID); InstanceIdentifier<?> bindingDeserializerOrNull(String iidString);  }### Answer:
@Test public void testModuleForPrefix() { Module module = mock(Module.class); doReturn(ImmutableSet.of(module)).when(context).findModules(""); assertEquals("Found Module", module, instanceIdCodec.moduleForPrefix("")); doReturn(ImmutableSet.of(module, mock(Module.class))).when(context).findModules("foo"); assertEquals("Found Module", module, instanceIdCodec.moduleForPrefix("foo")); when(context.findModules("bar")).thenReturn(Collections.emptySet()); assertNull(instanceIdCodec.moduleForPrefix("bar")); }