@Test
public void testCacheIpfixDataSet() throws Exception {

    Long obsvDomain = 4335L;
    String hostname = "deviceA";
    byte[] data = IpfixUtilities.hexStringToByteArray("0103001800");
    IpfixDataSet expected = new IpfixDataSet(data);
    m_ipfixfeCachingService.cacheIpfixDataSet(obsvDomain, hostname, expected);
    List<IpfixDataSet> result = m_ipfixfeCachingService.getAndInvalidateIpfixDataSet(obsvDomain, hostname);
    assertEquals(1, result.size());
    IpfixSetHeader expectedHeader = expected.getHeader();
    IpfixSetHeader actualHeader = result.get(0).getHeader();
    // Verify header
    assertEquals(expectedHeader.getId(), actualHeader.getId());
    assertEquals(expectedHeader.getLength(), actualHeader.getLength());
    assertTrue("IpfixSetHeader.getPresentation() isn't returned correctly", Arrays.equals(expectedHeader.getPresentation(), actualHeader.getPresentation()));
    // Verify content
    assertTrue("IpfixDataSet.getRawData() isn't returned correctly", Arrays.equals(expected.getRawData(), result.get(0).getRawData()));
    assertEquals(expected.getRecords(), result.get(0).getRecords());
    assertTrue("IpfixDataSet.getPresentation() isn't returned correctly", Arrays.equals(expected.getPresentation(), result.get(0).getPresentation()));
    // After invalidate cache
    result = m_ipfixfeCachingService.getAndInvalidateIpfixDataSet(obsvDomain, hostname);
    assertEquals(0, result.size());
}