-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuildDwellingTest.java
More file actions
42 lines (33 loc) · 1.11 KB
/
BuildDwellingTest.java
File metadata and controls
42 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.dddheroes.heroesofddd.creaturerecruitment.write.builddwelling;
import com.dddheroes.heroesofddd.creaturerecruitment.write.DwellingTest;
import com.dddheroes.heroesofddd.shared.domain.DomainRule;
import org.junit.jupiter.api.*;
import java.util.List;
class BuildDwellingTest extends DwellingTest {
@Test
void givenNotBuiltDwellingWhenBuildThenBuilt() {
// given
var givenEvents = List.of();
// when
var whenCommand = buildDwelling();
// then
var thenEvent = dwellingBuilt();
fixture.given(givenEvents)
.when(whenCommand)
.expectEvents(thenEvent);
}
@Test
void givenBuiltDwellingWhenBuildSameOneMoreTimeThenException() {
// given
var givenEvents = List.of(
dwellingBuilt()
);
// when
var whenCommand = buildDwelling();
// then
fixture.given(givenEvents)
.when(whenCommand)
.expectException(DomainRule.ViolatedException.class)
.expectExceptionMessage("Only not built building can be build");
}
}