Skip to content

Commit

Permalink
Add more tests for ErrorContextBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight committed Oct 20, 2023
1 parent 3464263 commit 3e1e809
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,42 @@ void shouldAllowSkippingCleanupJobRegistration() {
}
}

@Nested
class Resources {

@Test
void shouldRegisterResourcesByDefault() {
var builder = ErrorContextBuilder.newInstance()
.environment(environment)
.serviceDetails(serviceDetails)
.dataStoreType(DataStoreType.NOT_SHARED);

builder.buildWithConcurrentMapDao();

var jersey = environment.jersey();
verify(jersey).register(isA(ApplicationErrorResource.class));
verify(jersey).register(isA(GotErrorsResource.class));
verifyNoMoreInteractions(jersey);
}

@Test
void shouldAllowSkippingResourceRegistration() {
var builder = ErrorContextBuilder.newInstance()
.environment(environment)
.serviceDetails(serviceDetails)
.dataStoreType(DataStoreType.NOT_SHARED)
.skipErrorsResource()
.skipGotErrorsResource();

builder.buildWithConcurrentMapDao();

var jersey = environment.jersey();
verify(jersey, never()).register(isA(ApplicationErrorResource.class));
verify(jersey, never()).register(isA(GotErrorsResource.class));
verifyNoMoreInteractions(jersey);
}
}

@Nested
class RecentApplicationErrorsHealthCheck {

Expand Down

0 comments on commit 3e1e809

Please sign in to comment.