Skip to content

Commit

Permalink
Fixed bug with optional field operation: AgentJava crashed if it was …
Browse files Browse the repository at this point in the history
…missing (#11)
  • Loading branch information
vharvala authored and danivaan committed Jul 11, 2016
1 parent e4601e9 commit 886c0b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public OperationValidator(AgentConfig conf) {

@Override
public void validate(Transaction entry) {
if(!config.getOperations().entryExists(entry.getOperationKey()))
if(null != entry.getOperationKey() && !config.getOperations().entryExists(entry.getOperationKey()))
throw new AgentCoreException("Operation does not exist: " + entry.getOperationKey());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public void setUp() {
.build();
}

@Test
public void testDoesNotThrowWithMissingOperation() {
Transaction tle = new Transaction(agent.getAgentConfig());
tle.setFromKey("esb");
tle.setToKey("app01");

agent.addTransaction(tle);
}

@Test
public void testDoesNotThrowWithValidOperation() {
Transaction tle = new Transaction(agent.getAgentConfig());
Expand Down

0 comments on commit 886c0b2

Please sign in to comment.