### Question:
NormalizedRMResource implements RMResource { public static List<NormalizedRMResource> normalize(RMResource rmResource, int stdCpuVCores, int stdMemoryMbs) { int cpuResources = getNormalizedCount(rmResource.getCpuVCoresAsk(), stdCpuVCores); int memoryResources = getNormalizedCount(rmResource.getMemoryMbsAsk(), stdMemoryMbs); List<NormalizedRMResource> list = new ArrayList<NormalizedRMResource>(); for (int i = 0; i < cpuResources; i++) { list.add(new NormalizedRMResource(rmResource, stdCpuVCores, 0)); } for (int i = 0; i < memoryResources; i++) { list.add(new NormalizedRMResource(rmResource, 0, stdMemoryMbs)); } return list; } NormalizedRMResource(RMResource source, int effectiveCpuVCores,
      int effectiveMemoryMb); static List<NormalizedRMResource> normalize(RMResource rmResource,
      int stdCpuVCores, int stdMemoryMbs); RMResource getSource(); @Override String getLocation(); @Override int getCpuVCores(); @Override int getMemoryMbs(); @Override UUID getResourceId(); @Override Object getRmResourceId(); @Override void setRmResourceId(Object rmResourceId); @Override Map<String, Object> getRmData(); @Override String getLocationAsk(); @Override Locality getLocalityAsk(); @Override int getCpuVCoresAsk(); @Override int getMemoryMbsAsk(); void setAllocationInfo(String location, int cpuVCores,
      int memoryMbs); @Override String toString();  }### Answer:
@Test public void testNormalizeOnTheLine() { RMResource requested = TestUtils.createRMResource("somenode", Locality.MUST, 3, 2048); List<NormalizedRMResource> chunks = NormalizedRMResource.normalize( requested, 1, 1024); Assert.assertEquals(5, chunks.size()); verifyChunks(chunks, 2048, 3, 1024, 1); }
@Test public void testNormalizeOffTheLine() { RMResource requested = TestUtils.createRMResource("somenode", Locality.MUST, 3, 3000); List<NormalizedRMResource> chunks = NormalizedRMResource.normalize( requested, 1, 1024); Assert.assertEquals(6, chunks.size()); verifyChunks(chunks, 3072, 3, 1024, 1); }
@Test public void testNormalizeNonMustLocality() { RMResource requested = TestUtils.createRMResource("somenode", Locality.PREFERRED, 3, 2048); List<NormalizedRMResource> chunks = NormalizedRMResource.normalize( requested, 1, 1024); Assert.assertEquals(5, chunks.size()); verifyChunks(chunks, 2048, 3, 1024, 1); }