protected final void proceedOneCommand(LogCommand command) { if (command.getPriority() > myPriorityThreshold) return; // proceed messages in a special way if (command instanceof AddMessageCommand) { AddMessageCommand addMessageCommand = (AddMessageCommand) command; myDelayedMessages.add(addMessageCommand.myAntMessage); } else { flushDelayedMessages(); // message type changed -> flush command.execute(myTreeView); command.execute(myPlainTextView); } }
// try to work with Commands after command has been invoked. Should throw // exceptions @Test public void testMultipleInvocations() throws NoHeadException, ConcurrentRefUpdateException, NoMessageException, UnmergedPathException, JGitInternalException, WrongRepositoryStateException { Git git = new Git(db); CommitCommand commitCmd = git.commit(); commitCmd.setMessage("initial commit").call(); try { // check that setters can't be called after invocation commitCmd.setAuthor(author); fail("didn't catch the expected exception"); } catch (IllegalStateException e) { // expected } LogCommand logCmd = git.log(); logCmd.call(); try { // check that call can't be called twice logCmd.call(); fail("didn't catch the expected exception"); } catch (IllegalStateException e) { // expected } }