@Test
public void testToResource() throws Exception {

  ViewURLResourceProvider provider = new ViewURLResourceProvider();
  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add(ViewURLResourceProvider.URL_NAME_PROPERTY_ID);
  propertyIds.add(ViewURLResourceProvider.URL_SUFFIX_PROPERTY_ID);
  ViewURLEntity viewURLEntity = createNiceMock(ViewURLEntity.class);
  ViewEntity viewEntity = createNiceMock(ViewEntity.class);
  ViewInstanceEntity viewInstanceEntity = createNiceMock(ViewInstanceEntity.class);
  expect(viewURLEntity.getUrlName()).andReturn("test").once();
  expect(viewURLEntity.getUrlSuffix()).andReturn("url").once();
  expect(viewURLEntity.getViewInstanceEntity()).andReturn(viewInstanceEntity).once();
  expect(viewInstanceEntity.getViewEntity()).andReturn(viewEntity).once();
  expect(viewEntity.getCommonName()).andReturn("FILES").once();
  expect(viewEntity.getVersion()).andReturn("1.0.0").once();
  expect(viewInstanceEntity.getName()).andReturn("test").once();
  replay(viewURLEntity, viewEntity, viewInstanceEntity);
  Resource resource = provider.toResource(viewURLEntity);
  assertEquals(resource.getPropertyValue(ViewURLResourceProvider.URL_NAME_PROPERTY_ID),"test");
  assertEquals(resource.getPropertyValue(ViewURLResourceProvider.URL_SUFFIX_PROPERTY_ID),"url");
  assertEquals(resource.getPropertyValue(ViewURLResourceProvider.VIEW_INSTANCE_NAME_PROPERTY_ID),"test");
  assertEquals(resource.getPropertyValue(ViewURLResourceProvider.VIEW_INSTANCE_VERSION_PROPERTY_ID),"1.0.0");
  assertEquals(resource.getPropertyValue(ViewURLResourceProvider.VIEW_INSTANCE_COMMON_NAME_PROPERTY_ID),"FILES");
  verify(viewURLEntity,viewInstanceEntity,viewEntity);
}