Skip to content

Commit

Permalink
Fix sonar issues
Browse files Browse the repository at this point in the history
- Add deprecated description to deprecated VersionedAggregateIdentifier
constructor
- Fix typo on IdentifierMissingException class-level JavaDoc
- Add copyright notice to IdentifierMissingException
- Remove unused Matchers.eq invocations in
AggregateAnnotationCommandHandlerTest
- Rename test methods of AggregateAnnotationCommandHandlerTest to not
contain test prefix
- Remove public modifier from AggregateAnnotationCommandHandlerTest test
 methods.

#2021
  • Loading branch information
smcvb committed Sep 12, 2022
1 parent 294e2b6 commit 9bc79fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.axonframework.common.AxonException;

/**
* Exception mean to indicate that a required identifier is missing in the processed message.
* Exception indicating that a required identifier is missing in the processed message.
*
* @author Stefan Andjelkovic
* @since 4.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class VersionedAggregateIdentifier {
*
* @param identifier The non-null string identifier of the targeted aggregate.
* @param version The expected version of the targeted aggregate, or {@code null} if the version is irrelevant.
* @deprecated In favor of {@link VersionedAggregateIdentifier#VersionedAggregateIdentifier(Object, Long)}, since
* the {@code identifier} can be a non-{@link String}.
*/
@Deprecated
public VersionedAggregateIdentifier(String identifier, Long version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void commandHandlerCreatesAggregateInstance() throws Exception {
}

@Test
void testCommandHandlerCreatesAlwaysAggregateInstance() throws Exception {
void commandHandlerCreatesAlwaysAggregateInstance() throws Exception {
final CommandCallback<Object, Object> callback = spy(LoggingCallback.INSTANCE);
final CommandMessage<Object> message = asCommandMessage(new AlwaysCreateCommand("id", "parameter"));
commandBus.dispatch(message, callback);
Expand All @@ -217,13 +217,13 @@ void testCommandHandlerCreatesAlwaysAggregateInstance() throws Exception {
verify(callback).onResult(commandCaptor.capture(), responseCaptor.capture());
assertEquals(message, commandCaptor.getValue());
assertEquals("Always create works fine", responseCaptor.getValue().getPayload());
verify(creationPolicyFactory).create(eq("id"));
verify(creationPolicyFactory).create("id");
newInstanceCallableFactoryCaptor.getValue().call();
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create(eq("id"));
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create("id");
}

@Test
void testCommandHandlerCreatesAlwaysAggregateInstanceWithNullId() throws Exception {
void commandHandlerCreatesAlwaysAggregateInstanceWithNullId() throws Exception {
final CommandCallback<Object, Object> callback = spy(LoggingCallback.INSTANCE);
final CommandMessage<Object> message = asCommandMessage(new AlwaysCreateCommand(null, "parameter"));
commandBus.dispatch(message, callback);
Expand All @@ -235,13 +235,13 @@ void testCommandHandlerCreatesAlwaysAggregateInstanceWithNullId() throws Excepti
verify(callback).onResult(commandCaptor.capture(), responseCaptor.capture());
assertEquals(message, commandCaptor.getValue());
assertEquals("Always create works fine", responseCaptor.getValue().getPayload());
verify(creationPolicyFactory).create(eq(null));
verify(creationPolicyFactory).create(null);
newInstanceCallableFactoryCaptor.getValue().call();
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create(eq(null));
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create(null);
}

@Test
public void commandHandlerCreatesOrUpdatesAggregateInstance() throws Exception {
void commandHandlerCreatesOrUpdatesAggregateInstance() throws Exception {
final CommandCallback<Object, Object> callback = spy(LoggingCallback.INSTANCE);
final CommandMessage<Object> message = asCommandMessage(new CreateOrUpdateCommand("id", "Hi"));

Expand All @@ -261,11 +261,11 @@ public void commandHandlerCreatesOrUpdatesAggregateInstance() throws Exception {
assertEquals("Create or update works fine", responseCaptor.getValue().getPayload());
verifyNoInteractions(creationPolicyFactory);
factoryCaptor.getValue().call();
verify(creationPolicyFactory).create(eq("id"));
verify(creationPolicyFactory).create("id");
}

@Test
public void testCommandHandlerCreatesOrUpdatesAggregateInstanceSupportsNullId() throws Exception {
void commandHandlerCreatesOrUpdatesAggregateInstanceSupportsNullId() throws Exception {
final CommandCallback<Object, Object> callback = spy(LoggingCallback.INSTANCE);
final CommandMessage<Object> message = asCommandMessage(new CreateOrUpdateCommand(null, "Hi"));

Expand All @@ -282,9 +282,9 @@ public void testCommandHandlerCreatesOrUpdatesAggregateInstanceSupportsNullId()
assertEquals(message, commandCaptor.getValue());
assertEquals("Create or update works fine", responseCaptor.getValue().getPayload());

verify(creationPolicyFactory).create(eq(null));
verify(creationPolicyFactory).create(null);
newInstanceCallableFactoryCaptor.getValue().call();
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create(eq(null));
verify(creationPolicyFactory, VerificationModeFactory.times(2)).create(null);
}

@Test
Expand Down

0 comments on commit 9bc79fd

Please sign in to comment.