public final class MockitoUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Comparable<T>> |
addComparator(Comparable<T> mock,
Comparator<T> comparator)
Add the supplied comparator to the mocked object.
|
static <T extends Comparable<T>> |
hashCodeComparator()
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> |
returnsReversedString() |
static void |
setUpHibernateTemplate(@NotNull TransactionAndHibernateTemplate mock)
|
static void |
setUpHibernateTemplate(@NotNull TransactionAndHibernateTemplate mock,
@NotNull org.springframework.transaction.TransactionStatus transactionStatus,
@NotNull org.hibernate.Session session,
@NotNull Connection connection)
|
public static <T extends Comparable<T>> Comparator<T> hashCodeComparator()
public static <T extends Comparable<T>> void addComparator(Comparable<T> mock, Comparator<T> comparator)
@NotNull public static @NotNull org.mockito.stubbing.Answer<Void> nonReturningAnswer(@NotNull @NotNull Consumer<org.mockito.invocation.InvocationOnMock> answer)
public static org.mockito.stubbing.Answer<String> returnsReversedString()
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)
TransactionAndHibernateTemplate
's methods (#doWork
,
#execute
). Mocked responses will call the actual code passed to the methods (TransactionCallback
,
HibernateCallback
, Work
).mock
- mock of the TransactionAndHibernateTemplate
to set uptransactionStatus
- used for TransactionOperations.execute(TransactionCallback)
session
- used for TransactionAndHibernateTemplate.execute(HibernateCallback)
connection
- used for TransactionAndHibernateTemplate.doWork(Work)
public static void setUpHibernateTemplate(@NotNull @NotNull TransactionAndHibernateTemplate mock)
TransactionAndHibernateTemplate
's methods (#doWork
,
#execute
). Mocked responses will call the actual code passed to the methods (TransactionCallback
,
HibernateCallback
, Work
). TransactionStatus
, Session
and Connection
instances will be mocked.mock
- mock of the TransactionAndHibernateTemplate
to set upCopyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.
View cookie preferences