FeatureSource fs = createNiceMock(FeatureSource.class);
FeatureCollection fc = createNiceMock(FeatureCollection.class);
expect(fs.getDataStore()).andReturn(ds);
expect(fs.getFeatures()).andReturn(fc);
expect(fs.getFeatures(Filter.INCLUDE)).andReturn(fc);
expect(fs.getFeatures(new DefaultQuery())).andReturn(fc);
replay(fs);
ReadOnlyFeatureSource ro = new ReadOnlyFeatureSource(fs, WrapperPolicy.HIDE);
assertTrue(ro.getDataStore() instanceof ReadOnlyDataStore);
ReadOnlyFeatureCollection collection = (ReadOnlyFeatureCollection) ro.getFeatures();
assertEquals(WrapperPolicy.HIDE, ro.policy);
assertTrue(ro.getFeatures(Filter.INCLUDE) instanceof ReadOnlyFeatureCollection);
assertTrue(ro.getFeatures(new DefaultQuery()) instanceof ReadOnlyFeatureCollection);
}