-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56c78c3
commit e10d67d
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/io/github/rabobank/shadow_tool/NoopEncryptionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.github.rabobank.shadow_tool; | ||
|
||
/** | ||
* A version of the Encryption Service that doesn't perform any encryption. | ||
* This might be useful for simple use-case where encryption of differences is not required, | ||
* for example with public data. | ||
*/ | ||
class NoopEncryptionService implements EncryptionService { | ||
public static final NoopEncryptionService INSTANCE = new NoopEncryptionService(); | ||
|
||
NoopEncryptionService() { | ||
} | ||
|
||
@Override | ||
public String encrypt(final String value) { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/test/java/io/github/rabobank/shadow_tool/NoopEncryptionServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.rabobank.shadow_tool; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class NoopEncryptionServiceTest { | ||
@Test | ||
void valuesAreNotEncrypted() { | ||
final var encryptionService = NoopEncryptionService.INSTANCE; | ||
final var plainDifferences = "'place' changed: 'Dintelooord' -> 'Dinteloord'\n" + | ||
"'madrigals' collection changes :\n" + | ||
" 1. 'Bruno' changed to 'Mirabel'\n" + | ||
" 0. 'Bruno' added"; | ||
final var encryptedDifferences = encryptionService.encrypt(plainDifferences); | ||
|
||
assertEquals(plainDifferences, encryptedDifferences); | ||
} | ||
} |