@Test
public void testMergeAdd() throws PlanningException {

  TreeMap<Long, Resource> a = new TreeMap<>();
  TreeMap<Long, Resource> b = new TreeMap<>();
  setupArrays(a, b);
  RLESparseResourceAllocation rleA =
      new RLESparseResourceAllocation(a, new DefaultResourceCalculator());
  RLESparseResourceAllocation rleB =
      new RLESparseResourceAllocation(b, new DefaultResourceCalculator());
  RLESparseResourceAllocation out =
      RLESparseResourceAllocation.merge(new DefaultResourceCalculator(),
          Resource.newInstance(100 * 128 * 1024, 100 * 32), rleA, rleB,
          RLEOperator.add, 18, 45);
  System.out.println(out);
  long[] time = { 18, 20, 22, 30, 33, 40, 43, 45 };
  int[] alloc = { 10, 15, 20, 25, 30, 40, 30 };
  validate(out, time, alloc);
}