@Test
public void testCollectTemplateSet() throws Exception {

    byte[] data = IpfixUtilities.hexStringToByteArray("000A01DB5DB0B80D00000000000010EF00020020011400038107FFFF" +
            "00000E918109000400000E91810A000400000E91011401AB0444534C3100000001000000020544534C3130000000010000000" +
            "10544534C313100000001000000010544534C313200000001000000010544534C313300000001000000010544534C31340000" +
            "0001000000020544534C313500000001000000010544534C313600000001000000010444534C3200000001000000010844534" +
            "C322E50544D00000001000000010444534C3300000001000000010844534C332E50544D00000001000000010444534C340000" +
            "0001000000010444534C3500000001000000010444534C3600000001000000010444534C3700000001000000010444534C380" +
            "0000001000000010444534C39000000010000000109534650312E45544831000000010000000109534650322E455448310000" +
            "00010000000106696E62616E6400000001000000010C6E66616365312D75736572310000000100000001076F757462616E640" +
            "0000001000000010773696E62616E64000000010000000108736F757462616E6400000001000000010C7566616365312D7573" +
            "65723100000001000000010C7566616365312D757365723300000001000000010258310000000100000001");
    IpfixMessage ipfixMessage = new IpfixMessage(data);
    ipfixMessage.getHeader().setExportTime(Instant.now().toString());
    AbstractTemplateRecord templateRecord = new IpfixTemplateRecord(new byte[16]);
    m_cachingService = mock(IpfixCachingServiceImpl.class);
    when(m_cachingService.getTemplateRecord(4335L, "hostname", 600)).thenReturn(templateRecord);
    String hostName = "hostname";
    String remoteAddress = "192.168.1.1";
    String username = "adminuser";
    String hashedPass = "$6$129267dbd52b96f3$BcacdzmrCHVqpQcEklp1ZjsBkW2n78xsTfl.nVKOFa.G1QXjC.MXtamcnAKCWRAMMg/rd/GCOSTq20T72CRGk.";
    Set<IpfixDecodedData> decodedDataSet = new HashSet<>();
    decodedDataSet.add(new IpfixDecodedData("8636.3729", "String", username));
    decodedDataSet.add(new IpfixDecodedData("8637.3729", "String", hashedPass));
    decodedDataSet.add(new IpfixDecodedData("5002.3729", "String", hostName));
    CollectingServiceImpl collectingService = new CollectingServiceImpl(m_decodingDataRecordService, m_cachingService,
            m_dataHandlerService, m_deviceFamilyCacheService) {
        @Override
        protected IpfixMessage createIpfixMessage(byte[] data) {
            return ipfixMessage;
        }
    };
    String family = "sample-DPU-model-tls-1.0";
    Optional<String> optionalHostName = Optional.of(hostName);
    when(m_deviceFamilyCacheService.getDeviceFamily(hostName)).thenReturn(family);
    when(m_decodingDataRecordService.decodeDataSet(eq(hostName), eq(4335L), any(), any(), any())).thenReturn(decodedDataSet);
    List<IpfixDataHandler> dataHandlers = new ArrayList<>();
    IpfixDataHandler dataHandler = mock(IpfixDataHandler.class);
    dataHandlers.add(dataHandler);
    when(m_dataHandlerService.getDataHandlers()).thenReturn(dataHandlers);
    collectingService.collect(m_data, remoteAddress, optionalHostName);
    ArgumentMatcher<String> messageMatcher = new ArgumentMatcher<String>() {
        @Override
        public boolean matches(Object o) {
            String msgAsStr = (String) o;
            Gson gson = new Gson();
            IpfixMessageNotification message = gson.fromJson(msgAsStr, IpfixMessageNotification.class);
            assertNotNull(message);
            assertNotNull(message.getTimestamp());
            assertEquals("hostname", message.getHostName());
            assertEquals("192.168.1.1", message.getSourceIP());
            assertEquals("sample-DPU-model-tls-1.0", message.getDeviceAdapter());
            assertEquals(276, message.getTemplateID());
            assertEquals(4335L, message.getObservationDomain());
            return true;
        }
    };
    verify(dataHandler).handleIpfixData(argThat(messageMatcher));
}