@Test
public void testLambdaFunctionTags() throws HandlerException {

  BaseHandler.CONFIG_FILE = "/config/handler_config_tags.json";
  TestContext context = new TestContext();
  context.setInvokedFunctionArn("arn:aws:lambda:us-east-1:123:function:test:test_tags");
  AWSLambdaClientFactory mockFactory = mock(AWSLambdaClientFactory.class);
  AWSLambda mockLambda = mock(AWSLambda.class);
  doReturn(mockLambda).when(mockFactory).newInstance();
  ListTagsResult mockResult = mock(ListTagsResult.class);
  HashMap<String, String> expected = new HashMap<String, String>() {
    {
      put("t1", "foo");
      put("t2", "bar");
    }
  };
  doReturn(expected).when(mockResult).getTags();
  doReturn(mockResult).when(mockLambda).listTags(any());
  handler.lambdaClientFactory = mockFactory;
  handler.init(context);
  Map<String, String> actual = handler.monitor.getTagsMap();
  assertTrue(actual.entrySet().containsAll(expected.entrySet()));
}