Examples of FakeAggregateRoot


Examples of com.xebia.cqrs.domain.FakeAggregateRoot

    public void setUp() {
        eventStore = new InMemoryEventStore<Event>();
        bus = createNiceMock(Bus.class);
        subject = new RepositoryImpl(eventStore, bus);

        aggregateRoot = new FakeAggregateRoot(TEST_ID);
        aggregateRoot.greetPerson("Erik");
        aggregateRoot.greetPerson("Sjors");
        subject.add(aggregateRoot);
    }
View Full Code Here

Examples of com.xebia.cqrs.domain.FakeAggregateRoot

        subject.add(aggregateRoot);
    }
   
    @Test
    public void shouldFailToAddAggregateWithoutAnyUnsavedChanges() {
        FakeAggregateRoot a = new FakeAggregateRoot(VersionedId.random());
        try {
            subject.add(a);
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException expected) {
        }
View Full Code Here

Examples of com.xebia.cqrs.domain.FakeAggregateRoot

   
    @Test
    public void shouldLoadAggregateRootFromEventStore() {
        subject.afterHandleMessage();
       
        FakeAggregateRoot result = subject.getByVersionedId(FakeAggregateRoot.class, TEST_ID);
       
        assertNotNull(result);
        assertEquals(aggregateRoot.getLastGreeting(), result.getLastGreeting());
    }
View Full Code Here

Examples of com.xebia.cqrs.domain.FakeAggregateRoot

        assertEquals(aggregateRoot.getLastGreeting(), result.getLastGreeting());
    }
   
    @Test
    public void shouldLoadAggregateOnlyOnce() {
        FakeAggregateRoot a = subject.getById(FakeAggregateRoot.class, TEST_ID.getId());

        assertSame(aggregateRoot, a);
    }
View Full Code Here

Examples of com.xebia.cqrs.domain.FakeAggregateRoot

        assertSame(aggregateRoot, a);
    }
   
    @Test
    public void shouldRejectDifferentAggregatesWithSameId() {
        FakeAggregateRoot a = aggregateRoot;
        FakeAggregateRoot b = new FakeAggregateRoot(TEST_ID);
        b.greetPerson("Jan");
       
        subject.add(a);
        try {
            subject.add(b);
            fail("IllegalStateException expected");
View Full Code Here

Examples of com.xebia.cqrs.domain.FakeAggregateRoot

    @Test
    public void shouldStoreLoadedAggregateWithNextVersion() {
        replay(bus);
        subject.afterHandleMessage();

        FakeAggregateRoot result = subject.getByVersionedId(FakeAggregateRoot.class, TEST_ID);
        result.greetPerson("Mark");
        subject.afterHandleMessage();
       
        FakeAggregateRoot loaded = subject.getByVersionedId(FakeAggregateRoot.class, TEST_ID.nextVersion());
       
        assertEquals("Hi Mark", loaded.getLastGreeting());
        verify(bus);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.