### Question:
BrokerUtils { public static RelatedGenesEngineRequestDto msg2dto(RelatedGenesRequestMessage msg) { RelatedGenesEngineRequestDto ret = new RelatedGenesEngineRequestDto(); if (msg == null) { LOG.warn("empty RelatedGenesRequestMessage"); } Collection<Collection<Long>> interactionNetworks = new ArrayList<Collection<Long>>(); Map<String, Collection<Long>> groupsMap = new Hashtable<String, Collection<Long>>(); for (NetworkDto network : msg.getNetworks()) { String type = "_"; if (network.getId() < 0) { type = "user"; } else { if (StringUtils.isNotEmpty(network.getType())) { type = network.getType().toLowerCase(); } } Collection<Long> groupNetworks = groupsMap.get(type); if (groupNetworks == null) { groupNetworks = new ArrayList<Long>(); groupsMap.put(type, groupNetworks); } groupNetworks.add(network.getId()); } LOG.debug("network collections: " + groupsMap); Iterator<String> iterator = groupsMap.keySet().iterator(); while (iterator.hasNext()) { String nextGroup = iterator.next(); Collection<Long> networks = groupsMap.get(nextGroup); if ((networks != null) && (networks.size() > 0)) { interactionNetworks.add(networks); } } ret.setInteractionNetworks(interactionNetworks); ret.setCombiningMethod(CombiningMethod.fromCode(msg.getCombiningMethod())); ret.setLimitResults(msg.getResultSize()); ret.setOrganismId(msg.getOrganismId()); ret.setPositiveNodes(msg.getPositiveNodes()); ret.setScoringMethod(ScoringMethod.DISCRIMINANT); ret.setNamespace(msg.getUserDefinedNetworkNamespace()); ret.setAttributeGroups(msg.getAttributeGroups()); ret.setAttributesLimit(msg.getAttributesLimit()); ret.setProgressReporter(NullProgressReporter.instance()); return ret; }  static RelatedGenesEngineRequestDto msg2dto(RelatedGenesRequestMessage msg); static RelatedGenesEngineRequestDto dto2dto(RelatedGenesWebRequestDto req); static UploadNetworkEngineRequestDto msg2dto(UploadNetworkRequestMessage msg); static UploadNetworkEngineRequestDto dto2dto(UploadNetworkWebRequestDto req); static RelatedGenesResponseMessage dto2msg(RelatedGenesEngineResponseDto dto); static RelatedGenesResponseMessage dto2msg(RelatedGenesEngineResponseDto rgdto,
			EnrichmentEngineResponseDto edto); static UploadNetworkResponseMessage dto2msg(UploadNetworkEngineResponseDto dto); static RelatedGenesRequestMessage dto2msg(RelatedGenesWebRequestDto dto); static UploadNetworkRequestMessage dto2msg(UploadNetworkWebRequestDto dto); static RelatedGenesWebResponseDto msg2dto(RelatedGenesResponseMessage msg); static Map<Long, Double> buildNodeScoresMap(Collection<NodeDto> nodes); static UploadNetworkWebResponseDto msg2dto(UploadNetworkResponseMessage msg); static EnrichmentEngineRequestDto buildEnrichmentRequestFrom(RelatedGenesEngineRequestDto rgRequestDto,
			RelatedGenesEngineResponseDto rgResponseDto, long ontologyId);  }### Answer:
@Test public void testMsg2dto() { try { RelatedGenesResponseMessage msg = RelatedGenesResponseMessageMock.getMockObject(1); RelatedGenesWebResponseDto actualDto = BrokerUtils.msg2dto(msg); assertNotNull("dto", actualDto); assertNotNull("networks", actualDto.getNetworks()); assertNotNull("network weights", actualDto.getNetworkWeightsMap()); assertNotNull("node scores", actualDto.getNodeScoresMap()); } catch (ApplicationException e) { fail(e.getMessage()); } }