{"id":158,"date":"2020-12-23T17:15:13","date_gmt":"2020-12-23T17:15:13","guid":{"rendered":"http:\/\/blog.codeandtech.com\/blog\/?p=158"},"modified":"2020-12-23T17:17:48","modified_gmt":"2020-12-23T17:17:48","slug":"aws-lambda-powermockito-mocking-static-methods-di","status":"publish","type":"post","link":"https:\/\/blog.codeandtech.com\/blog\/2020\/12\/23\/aws-lambda-powermockito-mocking-static-methods-di\/","title":{"rendered":"AWS Lambda PowerMockITO &#8211; mocking static methods &#038; DI"},"content":{"rendered":"\n<p>Thought of writing an article about mocking static methods in Java (there are quite a few available in the web). Just plugged in the combination of DI using Dagger and PowerMockIto<\/p>\n\n\n\n<p>An example implementation of uploading and downloading\/get files from AWS S3. Save and read rows from DynamoDB. The example provides JUnit testing using Mockito &amp; PowerMockITO<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1. Two sample lambdas (save and get) - to S3 and DynamodB\n2. Terraform implementation for deploying the lambda\n3. JUnit for S3 and DynamoDB testing\n4. Sample CLI commands to test<\/code><\/pre>\n\n\n\n<p>Read more <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/shivaramani\/aws-lambda-mockito\" target=\"_blank\">https:\/\/github.com\/shivaramani\/aws-lambda-mockito<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thought of writing an article about mocking static methods in Java (there are quite a few available in the web). Just plugged in the combination of DI using Dagger and PowerMockIto An example implementation of uploading and downloading\/get files from AWS S3. Save and read rows from DynamoDB. The example provides JUnit testing using Mockito &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.codeandtech.com\/blog\/2020\/12\/23\/aws-lambda-powermockito-mocking-static-methods-di\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AWS Lambda PowerMockITO &#8211; mocking static methods &#038; DI&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/158"}],"collection":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":2,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/posts\/158\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.codeandtech.com\/blog\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}