### Question:
ResourceProfile implements Serializable, Comparable<ResourceProfile> { @Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && obj.getClass() == ResourceProfile.class) { ResourceProfile that = (ResourceProfile) obj; return this.cpuCores == that.cpuCores && this.heapMemoryInMB == that.heapMemoryInMB && this.directMemoryInMB == that.directMemoryInMB && this.networkMemoryInMB == that.networkMemoryInMB && Objects.equals(extendedResources, that.extendedResources); } return false; } ResourceProfile(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int networkMemoryInMB,
			Map<String, Resource> extendedResources);  ResourceProfile(double cpuCores, int heapMemoryInMB);  ResourceProfile(ResourceProfile other); double getCpuCores(); int getHeapMemoryInMB(); int getDirectMemoryInMB(); int getNativeMemoryInMB(); int getNetworkMemoryInMB(); 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); @Override String toString(); static final ResourceProfile UNKNOWN; static final ResourceProfile ANY; }### Answer:
@Test public void testEquals() throws Exception { ResourceSpec rs1 = ResourceSpec.newBuilder().setCpuCores(1.0).setHeapMemoryInMB(100).build(); ResourceSpec rs2 = ResourceSpec.newBuilder().setCpuCores(1.0).setHeapMemoryInMB(100).build(); assertTrue(ResourceProfile.fromResourceSpec(rs1, 0).equals(ResourceProfile.fromResourceSpec(rs2, 0))); ResourceSpec rs3 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); ResourceSpec rs4 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(1.1). build(); assertFalse(ResourceProfile.fromResourceSpec(rs3, 0).equals(ResourceProfile.fromResourceSpec(rs4, 0))); ResourceSpec rs5 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); assertTrue(ResourceProfile.fromResourceSpec(rs3, 100).equals(ResourceProfile.fromResourceSpec(rs5, 100))); }