public static void viewInstanceDAOReturningNull() {
    Provider viewInstanceDAOProvider = createNiceMock(Provider.class);
    ViewInstanceDAO viewInstanceDAO = createNiceMock(ViewInstanceDAO.class);
    expect(viewInstanceDAOProvider.get()).andReturn(viewInstanceDAO).anyTimes();
    expect(viewInstanceDAO.findByResourceId(anyLong())).andReturn(null).anyTimes();

    replay(viewInstanceDAOProvider, viewInstanceDAO);

    AuthorizationHelper.viewInstanceDAOProvider = viewInstanceDAOProvider;
  }
Test helper to set DAO object to static variables and set proper expectation in AuthenticationHelper
ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperInitializer.java