@Test
public void testGuessOperationLevel() {

  Injector injector = createStrictMock(Injector.class);
  MaintenanceStateHelper maintenanceStateHelper =
          createMockBuilder(MaintenanceStateHelper.class)
                  .withConstructor(injector)
                  .createNiceMock();
  replay(maintenanceStateHelper);
  Assert.assertEquals(Resource.Type.Cluster, maintenanceStateHelper.guessOperationLevel(null));
  RequestResourceFilter resourceFilter = new RequestResourceFilter(null, null, null);
  Assert.assertEquals(Resource.Type.Cluster, maintenanceStateHelper.guessOperationLevel(resourceFilter));
  resourceFilter = new RequestResourceFilter("HDFS", null, null);
  Assert.assertEquals(Resource.Type.Service, maintenanceStateHelper.guessOperationLevel(resourceFilter));
  resourceFilter = new RequestResourceFilter("HDFS", "NAMENODE", null);
  Assert.assertEquals(Resource.Type.Service, maintenanceStateHelper.guessOperationLevel(resourceFilter));
  ArrayList<String> hosts = new ArrayList<String>();
  hosts.add("host1");
  hosts.add("host2");
  resourceFilter = new RequestResourceFilter("HDFS", null, hosts);
  Assert.assertEquals(Resource.Type.Cluster, maintenanceStateHelper.guessOperationLevel(resourceFilter));
  resourceFilter = new RequestResourceFilter(null, null, hosts);
  Assert.assertEquals(Resource.Type.Host, maintenanceStateHelper.guessOperationLevel(resourceFilter));
  resourceFilter = new RequestResourceFilter("HDFS", "NAMENODE", hosts);
  Assert.assertEquals(Resource.Type.HostComponent, maintenanceStateHelper.guessOperationLevel(resourceFilter));
}