### Question:
DefaultLaunchDataWrapper extends LaunchDataWrapper { protected String getStringFromFields(HandlerArgument commandLineArg, HandlerField environmentVar) { String payload = getStringFromFileArg(commandLineArg); return payload == null ? getEnvironmentRetriever().getField(environmentVar.name()) : payload; } DefaultLaunchDataWrapper(String[] args);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever, EnvironmentFieldRetriever environmentRetriever, PropertyRetriever propertyRetriever);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever); @Override String getPayload(); @Override OperationProgress getLastOperationProgress(); @Override T getLastProgressObject(Class<T> objectClass); @Override T getLastOperationProgressParam(String paramName, Class<T> objectClass); void setJsonHelper(JsonHelper jsonHelper);  }### Answer:
@Test(enabled = false) public void testGetStringFromFieldsFile() { launchDataWrapper = new DefaultLaunchDataWrapper(new String[] { "-" + HandlerArgument.PAYLOAD_FILE.getArgumentName(), TEST_FILE}); String data = launchDataWrapper.getStringFromFields(HandlerArgument.PAYLOAD_FILE, HandlerField.PAYLOAD); Assert.assertEquals(data, PAYLOAD_VALUE); }
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "Failed to load data from.*") public void testGetStringFromFieldsFileError() { final String BAD_FILE = TEST_FILE + "x"; launchDataWrapper = new DefaultLaunchDataWrapper(new String[] { "-" + HandlerArgument.PAYLOAD_FILE.getArgumentName(), BAD_FILE}); launchDataWrapper.getStringFromFields(HandlerArgument.PAYLOAD_FILE, HandlerField.PAYLOAD); }
@Test public void testGetStringFromFieldsArg() { doReturn(PAYLOAD_VALUE).when(mockEnvironmentFieldRetriever).getField(HandlerField.PAYLOAD.name()); String data = launchDataWrapper.getStringFromFields(HandlerArgument.PAYLOAD_FILE, HandlerField.PAYLOAD); verify(mockEnvironmentFieldRetriever, times(1)).getField(anyString()); Assert.assertEquals(data, PAYLOAD_VALUE); }
@Test public void testGetStringFromFieldsArgMissing() { String data = launchDataWrapper.getStringFromFields(HandlerArgument.PAYLOAD_FILE, HandlerField.PAYLOAD); verify(mockEnvironmentFieldRetriever, times(1)).getField(anyString()); Assert.assertNull(data); }