diff --git a/src/org/labkey/test/LabKeySiteWrapper.java b/src/org/labkey/test/LabKeySiteWrapper.java index ee5863824e..1272e53c8e 100644 --- a/src/org/labkey/test/LabKeySiteWrapper.java +++ b/src/org/labkey/test/LabKeySiteWrapper.java @@ -1721,23 +1721,29 @@ protected void deletePipelineJob(@LoggedParam String jobDescription, @LoggedPara public String getConversionErrorMessage(Object value, String fieldName, Class targetClass) { - return getConversionErrorMessage(value, fieldName, targetClass, true); + return getConversionErrorMessage(value, fieldName, targetClass, true, false); } // Note: Keep in sync with ConvertHelper.getStandardConversionErrorMessage() // Example: "Could not convert value '2.34' (Double) for Boolean field 'Medical History.Dep Diagnosed in Last 18 Months'" - public String getConversionErrorMessage(Object value, String fieldName, Class targetClass, boolean useUSDateParsing) + public String getConversionErrorMessage(Object value, String fieldName, Class targetClass, boolean useUSDateParsing, boolean withoutSingleQuotes) { + String errorMessage; String fieldType = targetClass.getSimpleName(); + String quote = withoutSingleQuotes ? "" : "'"; // Issue 50768: Need a better error message if date value is not in the expected format. if (fieldType.equalsIgnoreCase("date") || fieldType.equalsIgnoreCase("datetime") || fieldType.equalsIgnoreCase("timestamp")) { String parsingMode = useUSDateParsing ? "U.S. date parsing (MDY)" : "Non-U.S. date parsing (DMY)"; - return "'" + value + "' is not a valid " + fieldType + " for " + fieldName + " using " + parsingMode; + errorMessage = quote + value + quote + " is not a valid " + fieldType + " for " + fieldName + " using " + parsingMode; + } + else + { + errorMessage = "Could not convert value " + quote + value + quote + " (" + value.getClass().getSimpleName() + ") for " + fieldType + " field " + quote + fieldName + quote; } - return "Could not convert value '" + value + "' (" + value.getClass().getSimpleName() + ") for " + fieldType + " field '" + fieldName + "'" ; + return errorMessage; } private ProductKey getProductConfiguration() throws IOException, CommandException diff --git a/src/org/labkey/test/tests/InlineImagesListTest.java b/src/org/labkey/test/tests/InlineImagesListTest.java index fab04e0bb9..07c9d9ddcc 100644 --- a/src/org/labkey/test/tests/InlineImagesListTest.java +++ b/src/org/labkey/test/tests/InlineImagesListTest.java @@ -372,7 +372,7 @@ public final void testList() throws Exception importFilePathError(listImportPage, "1", PDF_FILE.getName()); importFilePathError(listImportPage, "5", PDF_FILE.getName()); - String attachmentError = "Can't upload '%s' to field %s with type Attachment."; + String attachmentError = "Cannot upload '%s' to Attachment type field '%s'."; String attachmentPdfError = String.format(attachmentError, PDF_FILE.getName(), LIST_ATTACHMENT01_NAME); String attachmentAbsentError = String.format(attachmentError, "Absent.txt", LIST_ATTACHMENT01_NAME); verifyQueryAPI("lists", LIST_NAME, Map.of(LIST_KEY_NAME, 5, LIST_ATTACHMENT01_NAME, PDF_FILE.getName()), true, "Row 1: " + attachmentPdfError); @@ -397,7 +397,7 @@ private void importFilePathError(ImportDataPage listImportPage, String key, Stri listImportPage.submitExpectingError(); try { - String expectedError = "Row 1: Can't upload '" + attachmentValue + "' to field " + LIST_ATTACHMENT01_NAME + " with type Attachment."; + String expectedError = "Row 1: Cannot upload '" + attachmentValue + "' to Attachment type field '" + LIST_ATTACHMENT01_NAME + "'."; checker().withScreenshot("import_error").verifyTrue("Invalid attachment error not as expected", isElementPresent(Locator.tagWithClass("div", "labkey-error").withText(expectedError))); } catch(NoSuchElementException nse)