public String toString() { String patterns = this.regexPatterns.stream().map(c -> { return c.toString(); }).collect(Collectors.joining(", ")); String operations = this.operationProcessors.stream().map(c -> { return c.getOperation().getClass().getSimpleName(); }).collect(Collectors.joining(", ")); return this.sourceName + "[" + "sourceRegex=" + this.sourceRegex + ", containsStrings=[" + StringUtils.join(this.containsStrings, ',') + "], regexPatterns=[" + patterns + "]" + "], deserializers=[" + this.deserProcessor + "]" + "], operations=[" + operations + "]]"; } }
public String toString() { String patterns = this.regexPatterns.stream().map(c -> { return c.toString(); }).collect(Collectors.joining(", ")); String operations = this.operationProcessors.stream().map(c -> { return c.getOperation().getClass().getSimpleName(); }).collect(Collectors.joining(", ")); return this.sourceName + "[" + "sourceRegex=" + this.sourceRegex + ", containsStrings=[" + StringUtils.join(this.containsStrings, ',') + "], regexPatterns=[" + patterns + "]" + "], deserializers=[" + this.deserProcessor + "]" + "], operations=[" + operations + "]]"; } }
@Test public void testOperationException() throws HandlerException { BaseHandler.CONFIG_FILE = "/config/handler_config.json"; handler.skipWriteStats = true; List<DummyEvent> events = new ArrayList<DummyEvent>(1); events.add(new DummyEvent("foo", 0)); TestContext context = new TestContext(); context.setInvokedFunctionArn("arn:aws:lambda:us-east-1:123:function:test:tag"); handler.init(context); List<OperationProcessor> operationProcessors = handler.sources.get(0).getOperationProcessors(); for (OperationProcessor operationProcessor : operationProcessors) { EventOperation operation = (EventOperation) spy(operationProcessor.getOperation()); doThrow(new OperationException("expected")).when(operation).perform(any()); operationProcessor.setOperation(operation); } handler.handler(events, context); assertEquals(1, operationProcessors.get(0).getErrorCountStat().getValue()); }