Files
spring-boot-rest/axon/src/test/java/com/baeldung/axon/MessagesAggregateIntegrationTest.java
Doha2012 48cd6f876f Fix test names (#1853)
* upgrade to spring boot 1.5.2

* add full update to REST API

* modify ratings controller

* upgrade herold

* fix integration test

* fix integration test

* minor fix

* fix integration test

* fix integration test

* minor cleanup

* minor cleanup

* remove log4j properties

* use standard logbook.xml

* remove log4j dependencies

* remove commons-logging

* merge

* fix conflict

* exclude commons-logging dependency

* cleanup

* minor fix

* minor fix

* fix dependency issues

* Revert "fix dependency issues"

This reverts commit 83bf1f9fd2.

* fix dependency issues

* minor fix

* minor fix

* minor fix

* cleanup generated files

* fix commons-logging issue

* add parent to pom

* cleanup parent dependencies

* cleanup pom

* cleanup pom

* add missing parent

* fix logging issue

* fix test names
2017-05-15 11:35:14 -05:00

42 lines
1.5 KiB
Java

package com.baeldung.axon;
import com.baeldung.axon.aggregates.MessagesAggregate;
import com.baeldung.axon.commands.CreateMessageCommand;
import com.baeldung.axon.commands.MarkReadMessageCommand;
import com.baeldung.axon.events.MessageCreatedEvent;
import com.baeldung.axon.events.MessageReadEvent;
import org.axonframework.test.aggregate.AggregateTestFixture;
import org.axonframework.test.aggregate.FixtureConfiguration;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
public class MessagesAggregateIntegrationTest {
private FixtureConfiguration<MessagesAggregate> fixture;
@Before
public void setUp() throws Exception {
fixture = new AggregateTestFixture<MessagesAggregate>(MessagesAggregate.class);
}
@Test
public void giveAggregateRoot_whenCreateMessageCommand_thenShouldProduceMessageCreatedEvent() throws Exception {
String eventText = "Hello, how is your day?";
String id = UUID.randomUUID().toString();
fixture.given()
.when(new CreateMessageCommand(id, eventText))
.expectEvents(new MessageCreatedEvent(id, eventText));
}
@Test
public void givenMessageCreatedEvent_whenReadMessageCommand_thenShouldProduceMessageReadEvent() throws Exception {
String id = UUID.randomUUID().toString();
fixture.given(new MessageCreatedEvent(id, "Hello :-)"))
.when(new MarkReadMessageCommand(id))
.expectEvents(new MessageReadEvent(id));
}
}