// Path: src/main/java/com/lmax/angler/monitoring/network/monitor/system/snmp/udp/SnmpUdpStatisticsHandler.java
// @FunctionalInterface
// public interface SnmpUdpStatisticsHandler
// {
//     /**
//      * Callback method.
//      * @param inErrors InErrors count
//      * @param receiveBufferErrors RecvbufErrors count
//      * @param inChecksumErrors InCsumErrors count
//      */
//     void onStatisticsUpdated(final long inErrors, final long receiveBufferErrors, final long inChecksumErrors);
// }
// 
// Path: src/test/java/com/lmax/angler/monitoring/network/monitor/ResourceUtil.java
// public static void writeDataFile(final String resourceName, final Path sourcePath) throws IOException, URISyntaxException
// {
//     copy(Paths.get(currentThread().getContextClassLoader().getResource(resourceName).toURI()),
//             new FileOutputStream(sourcePath.toFile(), false));
// }


import com.lmax.angler.monitoring.network.monitor.system.snmp.udp.SnmpUdpStatisticsHandler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import static com.lmax.angler.monitoring.network.monitor.ResourceUtil.writeDataFile;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
        writeDataFile("proc_net_snmp_sample.txt", inputPath);
        monitor = new SystemNetworkManagementMonitor(inputPath);
    }

    @After
    public void after() throws Exception
    {
        Files.deleteIfExists(inputPath);
    }

    @Test
    public void shouldParseDataAndNotifyListener() throws Exception
    {
        monitor.poll(statsHandler);

        assertThat(statsHandler.getRecorded().size(), is(1));
        assertEntry(statsHandler.getRecorded().get(0), 78665L, 62374L, 37L);
    }

    private static void assertEntry(
            final SnmpUdpStatistic snmpUdpStatistic,
            final long inErrors,
            final long receiveBufferErrors,
            final long inChecksumErrors)
    {
        assertThat(snmpUdpStatistic.getInErrors(), is(inErrors));
        assertThat(snmpUdpStatistic.getReceiveBufferErrors(), is(receiveBufferErrors));
        assertThat(snmpUdpStatistic.getInChecksumErrors(), is(inChecksumErrors));
    }

// Path: src/main/java/com/lmax/angler/monitoring/network/monitor/system/snmp/udp/SnmpUdpStatisticsHandler.java
// @FunctionalInterface
// public interface SnmpUdpStatisticsHandler
// {
//     /**
//      * Callback method.
//      * @param inErrors InErrors count
//      * @param receiveBufferErrors RecvbufErrors count
//      * @param inChecksumErrors InCsumErrors count
//      */
//     void onStatisticsUpdated(final long inErrors, final long receiveBufferErrors, final long inChecksumErrors);
// }
// 
// Path: src/test/java/com/lmax/angler/monitoring/network/monitor/ResourceUtil.java
// public static void writeDataFile(final String resourceName, final Path sourcePath) throws IOException, URISyntaxException
// {
//     copy(Paths.get(currentThread().getContextClassLoader().getResource(resourceName).toURI()),
//             new FileOutputStream(sourcePath.toFile(), false));
// }


// Path: src/test/java/com/lmax/angler/monitoring/network/monitor/system/snmp/SystemNetworkManagementMonitorTest.java
import com.lmax.angler.monitoring.network.monitor.system.snmp.udp.SnmpUdpStatisticsHandler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import static com.lmax.angler.monitoring.network.monitor.ResourceUtil.writeDataFile;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

        writeDataFile("proc_net_snmp_sample.txt", inputPath);
        monitor = new SystemNetworkManagementMonitor(inputPath);
    }

    @After
    public void after() throws Exception
    {
        Files.deleteIfExists(inputPath);
    }

    @Test
    public void shouldParseDataAndNotifyListener() throws Exception
    {
        monitor.poll(statsHandler);

        assertThat(statsHandler.getRecorded().size(), is(1));
        assertEntry(statsHandler.getRecorded().get(0), 78665L, 62374L, 37L);
    }

    private static void assertEntry(
            final SnmpUdpStatistic snmpUdpStatistic,
            final long inErrors,
            final long receiveBufferErrors,
            final long inChecksumErrors)
    {
        assertThat(snmpUdpStatistic.getInErrors(), is(inErrors));
        assertThat(snmpUdpStatistic.getReceiveBufferErrors(), is(receiveBufferErrors));
        assertThat(snmpUdpStatistic.getInChecksumErrors(), is(inChecksumErrors));
    }

    private static final class RecordingSnmpUdpStatisticsHandler implements SnmpUdpStatisticsHandler