Skip to content

Commit

Permalink
Small testing additions
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 22, 2024
1 parent dc4df35 commit b2b70a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ void deleteGraffiti_shouldReturnErrorMessageWhenUnableToDeleteFile(@TempDir fina
assertThat(file.getParentFile().setWritable(false)).isTrue();

assertThatThrownBy(() -> manager.deleteGraffiti(publicKey))
.isInstanceOf(GraffitiManagementException.class);
.isInstanceOf(GraffitiManagementException.class)
.hasMessage("Unable to delete graffiti for validator " + publicKey);
assertThat(file.exists()).isTrue();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,29 @@ public void get_shouldDelegateToDefaultProviderWhenStorageProviderFails() throws
}

@Test
void getWithThrowable_shouldGetStorageGraffitiWhenAvailable() {
void getWithThrowable_shouldGetStorageGraffitiWhenAvailable() throws Throwable {
provider = new UpdatableGraffitiProvider(() -> Optional.of(storageGraffiti), Optional::empty);
assertThat(provider.get()).hasValue(storageGraffiti);
assertThat(provider.getWithThrowable()).hasValue(storageGraffiti);
}

@Test
void getWithThrowable_shouldGetStorageGraffitiWhenBothAvailable() {
void getWithThrowable_shouldGetStorageGraffitiWhenBothAvailable() throws Throwable {
provider =
new UpdatableGraffitiProvider(
() -> Optional.of(storageGraffiti), () -> Optional.of(defaultGraffiti));
assertThat(provider.get()).hasValue(storageGraffiti);
assertThat(provider.getWithThrowable()).hasValue(storageGraffiti);
}

@Test
void getWithThrowable_shouldGetDefaultGraffitiWhenStorageEmpty() {
void getWithThrowable_shouldGetDefaultGraffitiWhenStorageEmpty() throws Throwable {
provider = new UpdatableGraffitiProvider(Optional::empty, () -> Optional.of(defaultGraffiti));
assertThat(provider.get()).hasValue(defaultGraffiti);
assertThat(provider.getWithThrowable()).hasValue(defaultGraffiti);
}

@Test
void getWithThrowable_shouldBeEmptyWhenBothEmpty() {
void getWithThrowable_shouldBeEmptyWhenBothEmpty() throws Throwable {
provider = new UpdatableGraffitiProvider(Optional::empty, Optional::empty);
assertThat(provider.get()).isEmpty();
assertThat(provider.getWithThrowable()).isEmpty();
}

@Test
Expand Down

0 comments on commit b2b70a1

Please sign in to comment.