Skip to content
Advertisement

Tag: unit-testing

Best practice for Unit Testing class which is mostly responsible to call methods of dependencies, but contains logic as well

Let’s assume I have StartCommandHandler which has responsibility to create some file with required files. But for doing this I have to give him a set of sub-responsibilities, like: Checks whether file exists in the FTP If Not downloads files from multiple sources to the temp folder Then executes some script in the folder Then read generated file after script

What is mockito-inline and how does it work to mock final methods?

Javadocs in Mockito says – “Starting with version 2.7.6, we offer the ‘mockito-inline’ artifact that enables inline mock making without configuring the MockMaker extension file”. What does this mean? How does mockito-inline works ? Why a separate artifact for mockito-inline? Answer I stumbled upon this too and the answer is buried quite deep in the docs, so here it is.

How to disable AWS parameter store autoconfiguration for tests?

I have added spring-cloud-starter-aws-parameter-store-config dependency as explained in the spring documentation. Now, for unit tests I want to disable parameter store configuration. But not able to do it. I tried setting following property in test/application.properties Also tried excluding AwsParamStoreBootstrapConfiguration.class from AutoConfiguration but still not working. Exception Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement]: Factory method ‘ssmClient’ threw exception; nested exception

Advertisement