{
public void testCreate()
{
StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
SecurityManager securityManager = mock(SecurityManager.class);
ConfigurationEntry entry = mock(ConfigurationEntry.class);
Broker parent = mock(Broker.class);
when(parent.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(3000l);
when(parent.getSecurityManager()).thenReturn(securityManager);
VirtualHostRecoverer recoverer = new VirtualHostRecoverer(statisticsGatherer);
Map<String, Object> attributes = new HashMap<String, Object>();
String name = getName();
attributes.put(VirtualHost.NAME, name);
File file = TestFileUtils.createTempFile(this, ".xml", "<virtualhosts><virtualhost><name>" + name + "</name><" + name
+ "></" + name + "></virtualhost></virtualhosts>");
attributes.put(VirtualHost.CONFIG_PATH, file.getAbsolutePath());
when(entry.getAttributes()).thenReturn(attributes);
VirtualHost host = recoverer.create(null, entry, parent);
assertNotNull("Null is returned", host);
assertEquals("Unexpected name", getName(), host.getName());