@Test
  public void taskShouldBeExecutedIfRequiredHostgroupsAreResolved() throws Exception {
    // GIVEN
    expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.emptyList());
    expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.emptyMap());
    expect(clusterTopology.getClusterId()).andReturn(1L).anyTimes();
    expect(clusterTopology.getAmbariContext()).andReturn(ambariContext);
    expect(ambariContext.getClusterName(1L)).andReturn("testCluster");
    clusterConfigurationRequest.process();
    ambariEventPublisher.publish(anyObject(AmbariEvent.class));
    replayAll();

    // WHEN
    Boolean result = testSubject.call();

    // THEN
    verifyAll();
    Assert.assertTrue(result);
  }
Unit test for the ConfigureClusterTask class.
As business methods of this class don't return values, the assertions are made by verifying method calls on mocks.
Thus having strict mocks is essential!
ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java