Created
August 15, 2019 22:24
-
-
Save recursivecodes/6087e85622d5e497e47c9dd88065c2b6 to your computer and use it in GitHub Desktop.
KmsDemoFunctionTest.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
package codes.recursive; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fnproject.fn.testing.*; | |
import org.junit.*; | |
import java.io.IOException; | |
import java.util.Map; | |
import static org.junit.Assert.*; | |
public class KmsDemoFunctionTest { | |
@Rule | |
public final FnTestingRule testing = FnTestingRule.createDefault(); | |
@Test | |
public void shouldDecryptPassword() throws IOException { | |
testing.givenEvent().enqueue(); | |
testing.thenRun(KmsDemoFunction.class, "decryptSensitiveValue"); | |
FnResult result = testing.getOnlyResult(); | |
System.out.println(result.getBodyAsString()); | |
Map<String, String> resultMap = new ObjectMapper().readValue(result.getBodyAsString(), Map.class); | |
assertEquals("hunter2", resultMap.get("decryptedPassword")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment