DiffCommand extends BaseCommand { public void setEntries(final PathRevision[] entries) { Validate.notNull(entries); if (entries.length < 2) { throw new DiffException("The entry does not have a history."); } Arrays.sort(entries); toFileRevision = entries[0]; fromFileRevision = entries[1]; }  void setStyle(final DiffStyle style); void setEntries(final PathRevision[] entries); void setFrom(final PathRevision pathRevision); void setTo(final PathRevision pathRevision); boolean hasEntries(); DiffStyle getStyle(); String getFromPath(); String getFromTarget(); Revision getFromRevision(); PathRevision getFrom(); String getToPath(); PathRevision getTo(); String getToTarget(); Revision getToRevision(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testDiffCommandNull() throws Exception { DiffCommand command = new DiffCommand(); try { command.setEntries(null); fail("Should have thrown an IAE"); } catch (IllegalArgumentException ex) { } }
@Test public void testDiffCommandNoHistory() throws Exception { final String[] params = new String[]{ "/bug/code/try2/Order.java@92" }; final DiffCommand command = new DiffCommand(); try { command.setEntries(PathRevision.parse(params)); fail("Should throw DiffException"); } catch (DiffException ex) { } }
@Test public void testDiffCommandWrongDelimiter() throws Exception { final String[] params = new String[]{ "/bug/code/try2/OrderDetail.java##91", "/bug/code/try2/OrderDetailModel.java##90"}; final DiffCommand command = new DiffCommand(); try { command.setEntries(PathRevision.parse(params)); fail("Should throw IllegalArgumentException"); } catch (IllegalArgumentException ex) { } }