@Test
public void testGetHostAttributes() throws Exception {

  HostEntity hostEntity = createNiceMock(HostEntity.class);
  HostStateEntity hostStateEntity = createNiceMock(HostStateEntity.class);
  HostDAO hostDAO  = createNiceMock(HostDAO.class);
  HostStateDAO hostStateDAO  = createNiceMock(HostStateDAO.class);
  Gson gson = new Gson();
  expect(hostEntity.getHostAttributes()).andReturn("{\"foo\": \"aaa\", \"bar\":\"bbb\"}").anyTimes();
  expect(hostEntity.getHostId()).andReturn(1L).anyTimes();
  expect(hostEntity.getHostName()).andReturn("host1").anyTimes();
  expect(hostEntity.getHostStateEntity()).andReturn(hostStateEntity).anyTimes();
  expect(hostDAO.findById(1L)).andReturn(hostEntity).atLeastOnce();
  replayAll();
  HostImpl host = new HostImpl(hostEntity, gson, hostDAO, hostStateDAO);
  Map<String, String> hostAttributes = host.getHostAttributes();
  assertEquals("aaa", hostAttributes.get("foo"));
  assertEquals("bbb", hostAttributes.get("bar"));
  host = new HostImpl(hostEntity, gson, hostDAO, hostStateDAO);
  hostAttributes = host.getHostAttributes();
  assertEquals("aaa", hostAttributes.get("foo"));
  assertEquals("bbb", hostAttributes.get("bar"));
  verifyAll();
}