### Question:
StatisticDataCollectionHelper { public static void collectData(MessageContext messageContext, boolean isContentAltering, Boolean isCollectingTracing, StatisticDataUnit statisticDataUnit) { statisticDataUnit.setStatisticId(StatisticDataCollectionHelper.getStatisticTraceId(messageContext)); statisticDataUnit.setSynapseEnvironment(messageContext.getEnvironment()); statisticDataUnit.setParentList(getParentList(messageContext)); statisticDataUnit.setTime(System.currentTimeMillis()); if (isCollectingTracing != null && isCollectingTracing) { if (RuntimeStatisticCollector.isCollectingPayloads() && isContentAltering) { statisticDataUnit.setPayload(TracingDataCollectionHelper.collectPayload(messageContext)); } if (RuntimeStatisticCollector.isCollectingProperties()) { statisticDataUnit .setContextPropertyMap(TracingDataCollectionHelper.extractContextProperties(messageContext)); statisticDataUnit.setTransportPropertyMap( TracingDataCollectionHelper.extractTransportProperties(messageContext)); } } }  static String getStatisticTraceId(MessageContext messageContext); static int getFlowPosition(MessageContext messageContext); static int getParentFlowPosition(MessageContext messageContext, Integer newParentIndex); static List<Integer> getParentList(MessageContext messageContext); static boolean isOutOnlyFlow(MessageContext messageContext); static void collectData(MessageContext messageContext, boolean isContentAltering,
	                               Boolean isCollectingTracing, StatisticDataUnit statisticDataUnit); static void collectAggregatedParents(List<MessageContext> messages, MessageContext newCtx);  }### Answer:
@Test public void testCollectData() { PowerMockito.mockStatic(RuntimeStatisticCollector.class); PowerMockito.when(RuntimeStatisticCollector.isCollectingPayloads()).thenReturn(true); PowerMockito.when(RuntimeStatisticCollector.isCollectingProperties()).thenReturn(true); StatisticDataUnit dataUnit = new StatisticDataUnit(); StatisticDataCollectionHelper.collectData(messageContext, true, true, dataUnit); Assert.assertNotNull("context properties should be inserted", dataUnit.getContextPropertyMap()); Assert.assertNotNull("transport properties should be inserted", dataUnit.getTransportPropertyMap()); Assert.assertNotNull("payload should be inserted", dataUnit.getPayload()); }