use of com.nextdoor.bender.operation.substitution.context.ContextSubstitution in project bender by Nextdoor.
the class ContextSubstitutionTest method testExcludesContext.
@Test
public void testExcludesContext() throws FieldNotFoundException {
ArrayList<Substitution> substitutions = new ArrayList<Substitution>();
substitutions.add(new ContextSubstitution("foo", Collections.emptyList(), Arrays.asList("functionName"), true));
DummpyMapEvent devent = new DummpyMapEvent();
TestContext ctx = new TestContext();
ctx.setFunctionName("fun name");
ctx.setInvokedFunctionArn("some arn");
InternalEvent ievent = new InternalEvent("", new LambdaContext(ctx), 10);
ievent.setEventObj(devent);
ievent.setEventTime(20);
SubstitutionOperation op = new SubstitutionOperation(substitutions);
op.perform(ievent);
Map<String, Object> expected = new HashMap<String, Object>() {
{
put("invokedFunctionArn", "some arn");
}
};
assertEquals(expected, devent.getField("foo"));
}
use of com.nextdoor.bender.operation.substitution.context.ContextSubstitution in project bender by Nextdoor.
the class ContextSubstitutionTest method testIncludesContext.
@Test
public void testIncludesContext() throws FieldNotFoundException {
ArrayList<Substitution> substitutions = new ArrayList<Substitution>();
substitutions.add(new ContextSubstitution("foo", Arrays.asList("functionName"), Collections.emptyList(), true));
DummpyMapEvent devent = new DummpyMapEvent();
TestContext ctx = new TestContext();
ctx.setFunctionName("fun name");
ctx.setInvokedFunctionArn("some arn");
InternalEvent ievent = new InternalEvent("", new LambdaContext(ctx), 10);
ievent.setEventObj(devent);
ievent.setEventTime(20);
SubstitutionOperation op = new SubstitutionOperation(substitutions);
op.perform(ievent);
Map<String, Object> expected = new HashMap<String, Object>() {
{
put("functionName", "fun name");
}
};
assertEquals(expected, devent.getField("foo"));
}
Aggregations