package net.kencochrane.raven.connection;

import mockit.Injectable;
import mockit.Verifications;
import net.kencochrane.raven.event.Event;
import net.kencochrane.raven.marshaller.Marshaller;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.OutputStream;

public class UdpConnectionTest {
    private UdpConnection udpConnection;
    @Injectable
    private Marshaller mockMarshaller;

    @BeforeMethod
    public void setUp() throws Exception {
        udpConnection = new UdpConnection("", "", "");
        udpConnection.setMarshaller(mockMarshaller);
    }

    @Test
    public void testContentMarshalled(@Injectable final Event event) throws Exception {
        udpConnection.send(event);

        new Verifications() {{
            mockMarshaller.marshall(event, (OutputStream) any);
        }};
    }
}

@@ -62,16 +62,38 @@
 ctable;%0A
+import mockit.Tested;%0A
 import m
@@ -113,16 +113,16 @@
 ations;%0A
-
 import n
@@ -316,16 +316,45 @@
 tStream;
+%0Aimport java.net.InetAddress;
 %0A%0Apublic
@@ -380,16 +380,330 @@
 nTest %7B%0A
+    @Injectable%0A    private final String hostname = %22127.0.0.1%22;%0A    @Injectable%0A    private final int port = 1234;%0A    @Injectable%0A    private final String publicKey = %2244850120-9d2a-451b-8e00-998bddaa2800%22;%0A    @Injectable%0A    private final String secretKey = %221de38091-6e8c-42df-8298-cf7f8098617a%22;%0A    @Tested%0A
     priv
@@ -881,89 +881,11 @@
  = n
-ew UdpConnection(%22%22, %22%22, %22%22);%0A        udpConnection.setMarshaller(mockMarshaller)
+ull
 ;%0A  

Use Tested for UDP connection tests