extract assertEventStatus
This commit is contained in:
parent
3928c40258
commit
28c56a4fd6
@ -119,16 +119,8 @@ class DomainSetupHostingAssetFactoryUnitTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
emwFake.stream(BookingItemCreatedEventEntity.class)
|
assertEventStatus(givenBookingItem, givenAssetJson,
|
||||||
.reduce(EntityManagerWrapperFake::toSingleElement)
|
"[[DNS] no TXT record 'Hostsharing-domain-setup-verification-code=null' found for domain name 'example.org' (nor in its super-domain)]");
|
||||||
.map(eventEntity -> {
|
|
||||||
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
|
|
||||||
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
|
|
||||||
assertThat(eventEntity.getStatusMessage()).isEqualTo(
|
|
||||||
"[[DNS] no TXT record 'Hostsharing-domain-setup-verification-code=null' found for domain name 'example.org' (nor in its super-domain)]"
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -164,15 +156,8 @@ class DomainSetupHostingAssetFactoryUnitTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
emwFake.stream(BookingItemCreatedEventEntity.class)
|
assertEventStatus(givenBookingItem, givenAssetJson,
|
||||||
.reduce(EntityManagerWrapperFake::toSingleElement)
|
|
||||||
.map(eventEntity -> {
|
|
||||||
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
|
|
||||||
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
|
|
||||||
assertThat(eventEntity.getStatusMessage()).isEqualTo(
|
|
||||||
"domain DNS setup not allowed for legacy compatibility");
|
"domain DNS setup not allowed for legacy compatibility");
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@ -182,4 +167,20 @@ class DomainSetupHostingAssetFactoryUnitTest {
|
|||||||
.resources(Map.ofEntries(givenResources))
|
.resources(Map.ofEntries(givenResources))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertEventStatus(
|
||||||
|
final HsBookingItemRealEntity givenBookingItem,
|
||||||
|
final String givenAssetJson,
|
||||||
|
final String expected) {
|
||||||
|
emwFake.stream(BookingItemCreatedEventEntity.class)
|
||||||
|
.reduce(EntityManagerWrapperFake::toSingleElement)
|
||||||
|
.map(eventEntity -> {
|
||||||
|
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
|
||||||
|
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
|
||||||
|
assertThat(eventEntity.getStatusMessage()).isEqualTo(
|
||||||
|
expected
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user