@@ -0,0 +1,1924 @@
+package net.kencochrane.raven.connection;%0A%0Aimport mockit.*;%0Aimport net.kencochrane.raven.event.Event;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.mockito.Spy;%0Aimport org.testng.annotations.BeforeMethod;%0Aimport org.testng.annotations.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.UUID;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0Aimport static mockit.Deencapsulation.setField;%0Aimport static org.mockito.Mockito.verify;%0A%0Apublic class AbstractConnectionTest %7B%0A    private final String publicKey = UUID.randomUUID().toString();%0A    private final String secretKey = UUID.randomUUID().toString();%0A    private AbstractConnection abstractConnection;%0A    //Spying with mockito as jMockit doesn't support mocks of ReentrantLock%0A    @Spy%0A    private ReentrantLock reentrantLock = new ReentrantLock();%0A%0A    @BeforeMethod%0A    public void setUp() throws Exception %7B%0A        MockitoAnnotations.initMocks(this);%0A        abstractConnection = new DummyAbstractConnection(publicKey, secretKey);%0A        setField(abstractConnection, %22lock%22, reentrantLock);%0A    %7D%0A%0A    @Test%0A    public void testExceptionOnSendStartLockDown(@Injectable final Event mockEvent) throws Exception %7B%0A        new MockUp%3CDummyAbstractConnection%3E() %7B%0A            @SuppressWarnings(%22unused%22)%0A            @Mock%0A            protected void doSend(Event event) throws ConnectionException %7B%0A                throw new ConnectionException();%0A            %7D%0A        %7D;%0A%0A        abstractConnection.send(mockEvent);%0A%0A        verify(reentrantLock).tryLock();%0A    %7D%0A%0A    private static final class DummyAbstractConnection extends AbstractConnection %7B%0A        public DummyAbstractConnection(String publicKey, String secretKey) %7B%0A            super(publicKey, secretKey);%0A        %7D%0A%0A        @Override%0A        protected void doSend(Event event) throws ConnectionException %7B%0A        %7D%0A%0A        @Override%0A        public void close() throws IOException %7B%0A        %7D%0A    %7D%0A%7D%0A

Add tests for AbstractConnection