### Question:
FIXTransportSender extends AbstractTransportSender { private boolean isTargetValid(Map<String, String> fieldValues, SessionID targetSession, boolean beginStrValidation) { String beginString = fieldValues.get(FIXConstants.BEGIN_STRING); String deliverToCompID = fieldValues.get(FIXConstants.DELIVER_TO_COMP_ID); String deliverToSubID = fieldValues.get(FIXConstants.DELIVER_TO_SUB_ID); String deliverToLocationID = fieldValues.get(FIXConstants.DELIVER_TO_LOCATION_ID); if (beginStrValidation && !targetSession.getBeginString().equals(beginString)) { return false; } else if (!targetSession.getTargetCompID().equals(deliverToCompID)) { return false; } else if (deliverToSubID != null && !deliverToSubID.equals(targetSession.getTargetSubID())) { return false; } else if (deliverToLocationID != null && !deliverToLocationID.equals(targetSession.getTargetLocationID())) { return false; } return true; } FIXTransportSender(); void init(ConfigurationContext cfgCtx, TransportOutDescription transportOut); void stop(); void sendMessage(MessageContext msgCtx, String targetEPR,
                            OutTransportInfo outTransportInfo); void logOutIncomingSession(SessionID sessionID);  }### Answer:
@Test public void testIsTargetValid() throws Exception { Map<String, String> fieldValues = new HashMap<>(); fieldValues.put(FIXConstants.BEGIN_STRING, "FIX.4.1"); fieldValues.put(FIXConstants.DELIVER_TO_COMP_ID, "SYNAPSE"); fieldValues.put(FIXConstants.DELIVER_TO_SUB_ID, "sy"); fieldValues.put(FIXConstants.DELIVER_TO_LOCATION_ID, "randomLoc"); SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("BANZAI"), new SenderSubID("ba"), new SenderLocationID("senderLoc"), new TargetCompID("SYNAPSE"), new TargetSubID("sy"), new TargetLocationID("randomLoc"), "FIX.4.1:SYNAPSE->BANZAI"); FIXTransportSender sender = new FIXTransportSender(); Class senderClass = sender.getClass(); Method isTargetvalid = senderClass .getDeclaredMethod("isTargetValid", Map.class, SessionID.class, boolean.class); isTargetvalid.setAccessible(true); Object result = isTargetvalid.invoke(senderClass.newInstance(), fieldValues, id, true); Assert.assertEquals("Invalid target!", "true", result.toString()); }