Skip to content

Commit

Permalink
Merge pull request #2191 from AxonFramework/unnecessary-validation-id…
Browse files Browse the repository at this point in the history
…entifier

Remove unnecessary validation of aggregate identifier
  • Loading branch information
smcvb committed Apr 14, 2022
2 parents fd157be + dd984a1 commit 5e61d8c
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2021. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -429,15 +429,7 @@ public Object handle(CommandMessage<?> command) throws Exception {
String commandMessageAggregateId = commandMessageVersionedId.getIdentifier();

Aggregate<T> instance = repository.loadOrCreate(commandMessageAggregateId, factoryMethod);
Object commandResult = instance.handle(command);
Object aggregateId = instance.identifier();

assertThat(
aggregateId,
id -> id != null && id.toString() != null && id.toString().equals(commandMessageAggregateId),
"Identifier must be set after handling the message"
);
return commandResult;
return instance.handle(command);
}

@Override
Expand Down

0 comments on commit 5e61d8c

Please sign in to comment.