### Question:
FileWMSEnvoy extends AbstractEnvoy { @Override public void open() { final int numLayers = 5; final float initialSize = 45f; WMSLayerConfig conf = new WMSLayerConfig(); conf.setLayerTitle("BlueMarble"); String layerName = FileWMSLayer.class.getName() + ":" + getBaseDir(); conf.setLayerName(layerName); conf.setLayerKey(layerName); conf.setCacheImageFormat(MimeType.DDS.getMimeType()); WMSDataTypeInfo info = new WMSDataTypeInfo(getToolbox(), (Preferences)null, "FileWMS", new WMSLayerConfigurationSet(null, conf, null), conf.getLayerKey(), conf.getLayerTitle()); FileWMSLayer.Builder builder = new FileWMSLayer.Builder(info); builder.setLRCImageProvider(myFileSystemImageProvider); builder.setLayerCellDimensions(createLayerCellDimensions(numLayers, initialSize)); WMSLayer blueMarbleLayer = new FileWMSLayer(builder); String source = FileWMSEnvoy.class.getName() + ":" + myBaseDir; String family = WMSLayer.class.getName(); String category = ""; Date expiration = CacheDeposit.SESSION_END; Collection<? extends PropertyAccessor<WMSLayer, ?>> accessors = Collections .singleton(UnserializableAccessor.getHomogeneousAccessor(WMSLayer.PROPERTY_DESCRIPTOR)); CacheDeposit<? extends WMSLayer> deposit = new DefaultCacheDeposit<WMSLayer>( new DataModelCategory(source, family, category), accessors, Collections.singleton(blueMarbleLayer), true, expiration, true); getDataRegistry().addModels(deposit); } FileWMSEnvoy(Toolbox toolbox, String baseDir, String fileExtension); protected  FileWMSEnvoy(Toolbox toolbox); @Override void open(); @Override void setFilter(Object filter);  }### Answer:
@Test public void testOpen() { final FileWMSEnvoy[] envoy = new FileWMSEnvoy[1]; DataRegistry dataRegistry = EasyMock.createNiceMock(DataRegistry.class); final String source = FileWMSEnvoy.class.getName() + ":"; final String category = ""; final Date expiration = CacheDeposit.SESSION_END; EasyMock.reportMatcher(new IArgumentMatcher() { @Override public void appendTo(StringBuffer buffer) { buffer.append("matches(\"").append(CacheDeposit.class.getSimpleName()).append("(\"").append(source) .append("\",\"").append(category).append("\",\"").append(expiration).append("\",\"") .append(UnserializableAccessor.class.getSimpleName()).append('<').append(WMSLayer.class.getSimpleName()) .append(">\",(not empty)\")"); } @Override public boolean matches(Object arg0) { if (arg0 instanceof CacheDeposit<?>) { CacheDeposit<?> ins = (CacheDeposit<?>)arg0; if (ins.getCategory().getSource().equals(source) && ins.getCategory().getCategory().equals(category) && CollectionUtilities.hasContent(ins.getInput()) && ins.getAccessors().size() == 1) { PropertyAccessor<?, ?> accessor = ins.getAccessors().iterator().next(); if (accessor instanceof UnserializableAccessor<?, ?> && ((UnserializableAccessor<?, ?>)accessor) .getPropertyDescriptor().getType().equals(WMSLayer.class)) { return true; } } } return false; } }); EasyMock.expect(dataRegistry.addModels((CacheDeposit<WMSLayer>)null)).andReturn(new long[0]); EasyMock.replay(dataRegistry); Toolbox toolbox = WMSTestToolbox.getToolbox(false); EasyMock.expect(toolbox.getDataRegistry()).andReturn(dataRegistry); EasyMock.replay(toolbox); envoy[0] = new FileWMSEnvoy(toolbox, "", ""); envoy[0].open(null); EasyMock.verify(dataRegistry); }