### Question:
ReplicationProcessor implements Processor { protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; } ReplicationProcessor(ServerContext context); @Override ReplicationProcessor newProcessor(); @Override void process(String workID, byte[] data);  }### Answer:
@Test public void peerTypeExtractionFromConfiguration() { ServerContext context = createMock(ServerContext.class); String peerName = "peer"; String configuration = "java.lang.String,foo"; var conf = new ConfigurationCopy(Map.of(Property.REPLICATION_PEERS + peerName, configuration)); expect(context.getConfiguration()).andReturn(conf); replay(context); ReplicationProcessor proc = new ReplicationProcessor(context); assertEquals(configuration, proc.getPeerType(peerName)); verify(context); }
@Test(expected = IllegalArgumentException.class) public void noPeerConfigurationThrowsAnException() { ServerContext context = createMock(ServerContext.class); var conf = new ConfigurationCopy(Map.of()); expect(context.getConfiguration()).andReturn(conf); replay(context); ReplicationProcessor proc = new ReplicationProcessor(context); proc.getPeerType("foo"); verify(context); }