public void testHelper(Map<String, double[]> memUsed, Map<String, String> memRequested, Severity expectedSeverity,
      int expectedScore) {
    Configuration conf = new Configuration(false);
    List<Event> events = new ArrayList<>();
    for (Map.Entry<String, String> entry : memRequested.entrySet()) {
      String taskType = entry.getKey();
      conf.set(TonyConfigurationKeys.getResourceKey(taskType, Constants.MEMORY), entry.getValue());
      conf.setInt(TonyConfigurationKeys.getInstancesKey(taskType), memUsed.get(taskType).length);

      for (int i = 0; i < memUsed.get(taskType).length; i++) {
        events.add(new Event(EventType.TASK_FINISHED,
            new TaskFinished(taskType, i, TaskStatus.SUCCEEDED.toString(),
                ImmutableList.of(new Metric(Constants.MAX_MEMORY_BYTES, memUsed.get(taskType)[i]))),
            System.currentTimeMillis()));
      }
    }

    ApplicationType appType = new ApplicationType(Constants.APP_TYPE);
    TonyApplicationData data = new TonyApplicationData("application_123_456", appType, conf, events);

    TaskMemoryHeuristic heuristic = new TaskMemoryHeuristic(new HeuristicConfigurationData("ignored",
        "ignored", "ignored", appType, Collections.EMPTY_MAP));
    HeuristicResult result = heuristic.apply(data);
    Assert.assertEquals(expectedSeverity, result.getSeverity());
    Assert.assertEquals(expectedScore, result.getScore());
  }
Verifies that no exception is thrown when the task map is empty.
test/com/linkedin/drelephant/tony/heuristics/TaskMemoryHeuristicTest.java