CollectingServiceImpl implements CollectingService { protected IpfixMessage createIpfixMessage(byte[] data) throws NotEnoughBytesException { IpfixMessage ipfixMessage; try { ipfixMessage = new IpfixMessage(data); } catch (NotEnoughBytesException e) { LOGGER.error("The IPFIX message is not correct formatted: " + IpfixUtilities.bytesToHex(data)); throw new NotEnoughBytesException("The IPFIX message is not correct formatted", e); } return ipfixMessage; } CollectingServiceImpl(DecodingDataRecordService decodingDataRecordService, IpfixCachingService cachingService,
                                 DataHandlerService dataHandlerService, DeviceCacheService deviceCacheService); @Override Map.Entry<Optional<Long>, Optional<String>> collect(byte[] data, String remoteAddress, Optional<String> optionalHostName); @Override void processAuthenFailure(); @Override void processDecodeFailure(); @Override void processMessageCount();  }
@Test public void testCreateIpfixMessage() { try { byte[] data = IpfixUtilities.hexStringToByteArray("0103002000"); CollectingServiceImpl collectingService = new CollectingServiceImpl(m_decodingDataRecordService, m_cachingService, m_dataHandlerService, m_deviceFamilyCacheService); collectingService.createIpfixMessage(data); fail(); } catch (NotEnoughBytesException e) { assertEquals("The IPFIX message is not correct formatted", e.getMessage()); } }