### Question:
ResourceProfile implements Serializable, Comparable<ResourceProfile> { public static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, int networkMemory) { if (ResourceSpec.UNKNOWN.equals(resourceSpec)) { return UNKNOWN; } Map<String, Resource> copiedExtendedResources = new HashMap<>(resourceSpec.getExtendedResources()); return new ResourceProfile( resourceSpec.getCpuCores(), resourceSpec.getHeapMemory(), resourceSpec.getDirectMemory(), resourceSpec.getNativeMemory(), networkMemory, resourceSpec.getManagedMemory(), copiedExtendedResources); } ResourceProfile(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int networkMemoryInMB,
			int managedMemoryInMB,
			Map<String, Resource> extendedResources);  ResourceProfile(double cpuCores, int heapMemoryInMB); private  ResourceProfile();  ResourceProfile(ResourceProfile other); double getCpuCores(); int getHeapMemoryInMB(); int getDirectMemoryInMB(); int getNativeMemoryInMB(); int getNetworkMemoryInMB(); int getManagedMemoryInMB(); int getMemoryInMB(); int getOperatorsMemoryInMB(); Map<String, Resource> getExtendedResources(); boolean isMatching(ResourceProfile required); @Override int compareTo(@Nonnull ResourceProfile other); @Override int hashCode(); @Override boolean equals(Object obj); @Nonnull ResourceProfile merge(@Nonnull ResourceProfile other); ResourceProfile subtract(ResourceProfile other); @Override String toString(); static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, int networkMemory); static final ResourceProfile UNKNOWN; static final ResourceProfile ANY; static final ResourceProfile ZERO; }### Answer:
@Test public void testFromSpecWithSerializationCopy() throws Exception { final ResourceSpec copiedSpec = CommonTestUtils.createCopySerializable(ResourceSpec.UNKNOWN); final ResourceProfile profile = ResourceProfile.fromResourceSpec(copiedSpec, 0); assertEquals(ResourceProfile.fromResourceSpec(ResourceSpec.UNKNOWN, 0), profile); }