Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Add correct Company aggregate test
Browse files Browse the repository at this point in the history
Add correct Company aggregate test

#28
  • Loading branch information
smcvb committed Jun 1, 2018
1 parent 769c1dd commit 0015b23
Showing 1 changed file with 39 additions and 0 deletions.
@@ -0,0 +1,39 @@
package org.axonframework.samples.trader.company.command;

import org.axonframework.samples.trader.api.company.*;
import org.axonframework.samples.trader.api.orders.OrderBookId;
import org.axonframework.samples.trader.api.users.UserId;
import org.axonframework.test.aggregate.AggregateTestFixture;
import org.junit.Before;
import org.junit.Test;

public class CompanyTest {

private AggregateTestFixture<Company> fixture;

private CompanyId companyId = new CompanyId();
private OrderBookId orderBookId = new OrderBookId();

private CompanyCreatedEvent companyCreatedEvent;

@Before
public void setUp() {
fixture = new AggregateTestFixture<>(Company.class);

companyCreatedEvent = new CompanyCreatedEvent(companyId, "TestItem", 1000L, 10000L);
}

@Test
public void testCreateCompany() {
fixture.givenNoPriorActivity()
.when(new CreateCompanyCommand(companyId, new UserId(), "TestItem", 1000L, 10000L))
.expectEvents(companyCreatedEvent);
}

@Test
public void testAddOrderBookToCompany() {
fixture.given(companyCreatedEvent)
.when(new AddOrderBookToCompanyCommand(companyId, orderBookId))
.expectEvents(new OrderBookAddedToCompanyEvent(companyId, orderBookId));
}
}

0 comments on commit 0015b23

Please sign in to comment.