ScheduledJob implements Comparable<ScheduledJob> { @Override public boolean equals( Object obj ) { return obj instanceof ScheduledJob && Objects.equals(((ScheduledJob) obj).jobName, this.jobName ); } ScheduledJob();  ScheduledJob( String jobId ); void setJobId( String jobId ); String getJobId(); String getJobName(); void setJobName( String jobName ); String getAppName(); void setAppName( String appName ); String getCmdName(); void setCmdName( String cmdName ); String getCron(); void setCron( String cron ); @Override int compareTo( ScheduledJob job ); @Override boolean equals( Object obj ); @Override int hashCode();  }
@Test public void testEquals() { ScheduledJob job3 = new ScheduledJob(); ScheduledJob job4 = new ScheduledJob(); ScheduledJob job5 = new ScheduledJob(); job3.setJobName( "job3" ); job5.setJobName( "job3" ); Assert.assertEquals( job3, job5 ); Assert.assertEquals( job3.hashCode(), job5.hashCode()); Assert.assertNotEquals( job4, job5 ); Assert.assertNotEquals( job4.hashCode(), job5.hashCode()); }