Use BDD mockito

See gh-6869
pull/7002/head
Stephane Nicoll 8 years ago
parent b88cb35ea2
commit 6eb0449aa9

@ -22,10 +22,10 @@ import javax.jms.ConnectionMetaData;
import javax.jms.JMSException; import javax.jms.JMSException;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -86,8 +86,8 @@ public class JmsHealthIndicatorTests {
given(connectionMetaData.getJMSProviderName()).willReturn("JMS test provider"); given(connectionMetaData.getJMSProviderName()).willReturn("JMS test provider");
Connection connection = mock(Connection.class); Connection connection = mock(Connection.class);
given(connection.getMetaData()).willReturn(connectionMetaData); given(connection.getMetaData()).willReturn(connectionMetaData);
Mockito.doThrow(new JMSException("Could not start", "123")) willThrow(new JMSException("Could not start", "123"))
.when(connection).start(); .given(connection).start();
given(connectionFactory.createConnection()) given(connectionFactory.createConnection())
.willReturn(connection); .willReturn(connection);
JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory);

Loading…
Cancel
Save