@Test
public void testPopulateFirstClassEntities() {

    AccountVO account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
    account.setId(ACCOUNT_ID);
    UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone",
            UUID.randomUUID().toString(), User.Source.UNKNOWN);
    Mockito.when(accountDao.findById(ACCOUNT_ID)).thenReturn(account);
    Mockito.when(userDao.findById(USER_ID)).thenReturn(user);
    CallContext.register(user, account);
    //Inject some entity UUIDs into the call context
    String instanceUuid = UUID.randomUUID().toString();
    String ipUuid = UUID.randomUUID().toString();
    CallContext.current().putContextParameter(VirtualMachine.class, instanceUuid);
    CallContext.current().putContextParameter(IpAddress.class, ipUuid);
    ActionEventUtils.onActionEvent(USER_ID, ACCOUNT_ID, account.getDomainId(), "StaticNat", "Test event");
    //Assertions
    Assert.assertNotEquals(publishedEvents.size(), 0);
    Assert.assertEquals(publishedEvents.size(), 1);
    Event event = publishedEvents.get(0);
    Assert.assertNotNull(event.getDescription());
    JsonObject json = new JsonParser().parse(event.getDescription()).getAsJsonObject();
    Assert.assertTrue(json.has("VirtualMachine"));
    Assert.assertTrue(json.has("IpAddress"));
    Assert.assertEquals(json.get("VirtualMachine").getAsString(), instanceUuid);
    Assert.assertEquals(json.get("IpAddress").getAsString(), ipUuid);
    CallContext.unregister();
}