Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: comment log to explore sonar behaviour #177

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ For further reference, please consider the following sections:

* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.3/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.3/maven-plugin/reference/html/#build-image)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.3/maven-plugin/reference/html/#build-image)
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public BlobApplicationAware decrypt(BlobApplicationAware blob) {
log.info("Blob decrypted: {}", blob.getBlob());

} catch (IllegalArgumentException e) {
log.warn("{}: {}", e.getMessage(), blob.getBlob());
//log.warn("{}: {}", e.getMessage(), blob.getBlob());
decryptFailed = true;
} catch (Exception e) {
log.error("Cannot decrypt {}: {} {}", blob.getBlob(), e.getMessage(), e.getCause());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,23 @@ void shouldDecrypt(CapturedOutput output)

}

@Test
void shouldWarnNoData(CapturedOutput output)
throws IOException, PGPException {

//Mock decrypter behaviour
when(mockDecrypterImpl.decrypt(any(BlobApplicationAware.class))).thenCallRealMethod();
doThrow(new IllegalArgumentException("No data found in decrypted file")).when(
mockDecrypterImpl)
.decryptFile(any(), any(), any());

mockDecrypterImpl.decrypt(fakeBlob);

assertThat(output.getOut(), containsString("No data found in decrypted file"));

//Check if the local blob is cleaned up (given that it's empty)
assertFalse(Files.exists(Path.of(tmpDirectory, blobName)));
}
// @Test
// void shouldWarnNoData(CapturedOutput output)
// throws IOException, PGPException {
//
// //Mock decrypter behaviour
// when(mockDecrypterImpl.decrypt(any(BlobApplicationAware.class))).thenCallRealMethod();
// doThrow(new IllegalArgumentException("No data found in decrypted file")).when(
// mockDecrypterImpl)
// .decryptFile(any(), any(), any());
//
// mockDecrypterImpl.decrypt(fakeBlob);
//
// assertThat(output.getOut(), containsString("No data found in decrypted file"));
//
// //Check if the local blob is cleaned up (given that it's empty)
// assertFalse(Files.exists(Path.of(tmpDirectory, blobName)));
// }

@ParameterizedTest
@ValueSource(strings = {"Secret key for message not found.",
Expand Down