Format implements Cloneable { public boolean matches(Format fmt) { return this.name.equals(fmt.name); } Format(EncodingName name); EncodingName getName(); void setName(EncodingName name); Text getOptions(); void setOptions(Text options); @Override String toString(); boolean matches(Format fmt); boolean shouldSendPTime(); void setSendPTime(Boolean newValue); @Override Format clone();  }
@Test public void testMatch() { Format f1 = new Format(new EncodingName("name1")); Format f2 = new Format(new EncodingName("Name1")); assertTrue("Formats must match", f1.matches(f2)); }
@Test public void testSimmetryMatch() { Format f1 = new Format(new EncodingName("name1")); Format f2 = new Format(new EncodingName("Name1")); assertTrue("Formats must match", f2.matches(f1)); }
@Test public void testComporatorExecutionTime() { Format f1 = new Format(new EncodingName("name1")); Format f2 = new Format(new EncodingName("Name1")); long s = System.nanoTime(); for (int i = 0; i < 100; i++) { f1.matches(f2); } long f = System.nanoTime(); System.out.println("Match execution time=" + (f-s)); }