Package com.atlassian.bamboo.mockito
Class MockitoUtils
java.lang.Object
com.atlassian.bamboo.mockito.MockitoUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
voidaddComparator(Comparable<T> mock, Comparator<T> comparator) Add the supplied comparator to the mocked object.static <T extends Comparable<T>>
Comparator<T> Creates a comparator that compares identity hashcodes of the supplied objects.static @NotNull org.mockito.stubbing.Answer<Void> nonReturningAnswer(@NotNull Consumer<org.mockito.invocation.InvocationOnMock> answer) static org.mockito.stubbing.Answer<String> static voidsetUpHibernateTemplate(@NotNull TransactionAndHibernateTemplate mock) static voidsetUpHibernateTemplate(@NotNull TransactionAndHibernateTemplate mock, @NotNull org.springframework.transaction.TransactionStatus transactionStatus, @NotNull org.hibernate.Session session, @NotNull Connection connection)
-
Method Details
-
hashCodeComparator
Creates a comparator that compares identity hashcodes of the supplied objects. -
addComparator
public static <T extends Comparable<T>> void addComparator(Comparable<T> mock, Comparator<T> comparator) Add the supplied comparator to the mocked object. -
nonReturningAnswer
-
returnsReversedString
-
setUpHibernateTemplate
public static void setUpHibernateTemplate(@NotNull @NotNull TransactionAndHibernateTemplate mock, @NotNull @NotNull org.springframework.transaction.TransactionStatus transactionStatus, @NotNull @NotNull org.hibernate.Session session, @NotNull @NotNull Connection connection) Set up mocked responses forTransactionAndHibernateTemplate's methods (#doWork,#execute). Mocked responses will call the actual code passed to the methods (TransactionCallback,HibernateCallback,Work).- Parameters:
mock- mock of theTransactionAndHibernateTemplateto set uptransactionStatus- used forTransactionOperations.execute(TransactionCallback)session- used forinvalid reference
TransactionAndHibernateTemplate#execute(HibernateCallback<Void>)connection- used forTransactionAndHibernateTemplate.doWork(Work)
-
setUpHibernateTemplate
Set up mocked responses forTransactionAndHibernateTemplate's methods (#doWork,#execute). Mocked responses will call the actual code passed to the methods (TransactionCallback,HibernateCallback,Work).TransactionStatus,SessionandConnectioninstances will be mocked.- Parameters:
mock- mock of theTransactionAndHibernateTemplateto set up
-