### Question:
ResourceSpec implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && obj.getClass() == ResourceSpec.class) { ResourceSpec that = (ResourceSpec) obj; return this.cpuCores == that.cpuCores && this.heapMemoryInMB == that.heapMemoryInMB && this.directMemoryInMB == that.directMemoryInMB && this.nativeMemoryInMB == that.nativeMemoryInMB && this.stateSizeInMB == that.stateSizeInMB && this.managedMemoryInMB == that.managedMemoryInMB && Objects.equals(this.extendedResources, that.extendedResources); } else { return false; } } private  ResourceSpec(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int stateSizeInMB,
			int managedMemoryInMB,
			Resource... extendedResources); private  ResourceSpec(); ResourceSpec merge(ResourceSpec other); double getCpuCores(); int getHeapMemory(); int getDirectMemory(); int getNativeMemory(); int getStateSize(); int getManagedMemory(); double getGPUResource(); Map<String, Resource> getExtendedResources(); boolean isValid(); boolean lessThanOrEqual(@Nonnull ResourceSpec other); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Builder newBuilder(); static final ResourceSpec UNKNOWN; static final ResourceSpec DEFAULT; static final String GPU_NAME; }### 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(); assertEquals(rs1, rs2); assertEquals(rs2, rs1); ResourceSpec rs3 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); ResourceSpec rs4 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(1). build(); assertNotEquals(rs3, rs4); ResourceSpec rs5 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); assertEquals(rs3, rs5); }