|
26 | 26 | import java.util.Map; |
27 | 27 |
|
28 | 28 | import static org.junit.Assert.assertEquals; |
| 29 | +import static org.labkey.test.params.FieldDefinition.labelFromName; |
| 30 | +import static org.labkey.test.util.TextUtils.normalizeSpace; |
29 | 31 |
|
30 | 32 | // Issue 52098, Issue 49422 |
31 | 33 | @Category({Daily.class, Data.class, Hosting.class}) |
@@ -122,7 +124,8 @@ public void testWithoutValidatorOrAlternateKeys() throws IOException, CommandExc |
122 | 124 | String error = importDataPage |
123 | 125 | .setText(bulkData) |
124 | 126 | .submitExpectingError(); |
125 | | - checker().withScreenshot().verifyEquals("Error message for invalid primary key not as expected", "Could not convert value 'noneSuch' (String) for Integer field '" + lookFromLookupFieldName + "'", error); |
| 127 | + checker().withScreenshot().verifyEquals("Error message for invalid primary key not as expected", |
| 128 | + "Could not convert value 'noneSuch' (String) for Integer field '" + normalizeSpace(lookFromLookupFieldName) + "'", error); |
126 | 129 | } |
127 | 130 |
|
128 | 131 | @Test |
@@ -168,7 +171,8 @@ public void testWithoutValidatorWithAlternateKeys() throws IOException, CommandE |
168 | 171 | .setText(bulkData) |
169 | 172 | .setImportLookupByAlternateKey(true) |
170 | 173 | .submitExpectingError(); |
171 | | - checker().withScreenshot().verifyEquals("Error message after supplying invalid alternate key not as expected", "Value 'NotAValue' not found for field " + lookFromLookupFieldName + " in the current context.", error); |
| 174 | + checker().withScreenshot().verifyEquals("Error message after supplying invalid alternate key not as expected", |
| 175 | + "Value 'NotAValue' not found for field " + normalizeSpace(lookFromLookupFieldName) + " in the current context.", error); |
172 | 176 | } |
173 | 177 |
|
174 | 178 | @Test |
@@ -196,13 +200,16 @@ public void testWithLookupValidatorWithoutAlternateKeys() throws IOException, Co |
196 | 200 | String error = importDataPage |
197 | 201 | .setText(tsvFromColumn(List.of(lookFromLookupFieldName, "1000"))) |
198 | 202 | .submitExpectingError(); |
199 | | - checker().withScreenshot().verifyEquals("Error message for invalid primary key value not as expected", "Value '1000' was not present in lookup target 'lists." + lookToListName + "' for field '" + FieldDefinition.labelFromName(lookFromLookupFieldName) + "'", error); |
| 203 | + checker().withScreenshot().verifyEquals("Error message for invalid primary key value not as expected", |
| 204 | + "Value '1000' was not present in lookup target 'lists." + normalizeSpace(lookToListName) |
| 205 | + + "' for field '" + normalizeSpace(labelFromName(lookFromLookupFieldName)) + "'", error); |
200 | 206 |
|
201 | 207 | log("With lookup validation on, import data and provide an invalid primary key of type string."); |
202 | 208 | error = importDataPage |
203 | 209 | .setText(tsvFromColumn(List.of(lookFromLookupFieldName, "Look"))) |
204 | 210 | .submitExpectingError(); |
205 | | - checker().withScreenshot().verifyEquals("Error message for invalid primary key type not as expected", "Could not convert value 'Look' (String) for Integer field '" + lookFromLookupFieldName + "'", error); |
| 211 | + checker().withScreenshot().verifyEquals("Error message for invalid primary key type not as expected", |
| 212 | + "Could not convert value 'Look' (String) for Integer field '" + normalizeSpace(lookFromLookupFieldName) + "'", error); |
206 | 213 | } |
207 | 214 |
|
208 | 215 | @Test |
@@ -246,14 +253,17 @@ public void testWithLookupValidatorAndAlternateKeys() throws IOException, Comman |
246 | 253 | .setText(bulkData) |
247 | 254 | .setImportLookupByAlternateKey(true) |
248 | 255 | .submitExpectingError(); |
249 | | - checker().withScreenshot().verifyEquals("Error message for invalid string alternate key not as expected", "Value 'Invalid' not found for field " + lookFromLookupFieldName + " in the current context.", error); |
| 256 | + checker().withScreenshot().verifyEquals("Error message for invalid string alternate key not as expected", |
| 257 | + "Value 'Invalid' not found for field " + normalizeSpace(lookFromLookupFieldName) + " in the current context.", error); |
250 | 258 |
|
251 | 259 | bulkData = tsvFromColumn(List.of(lookFromLookupFieldName, "1234")); |
252 | 260 | error = importDataPage |
253 | 261 | .setText(bulkData) |
254 | 262 | .setImportLookupByAlternateKey(true) |
255 | 263 | .submitExpectingError(); |
256 | | - checker().withScreenshot().verifyEquals("Error message for invalid number-like alternate key not as expected", "Value '1234' was not present in lookup target 'lists." + lookToListName + "' for field '" + FieldDefinition.labelFromName(lookFromLookupFieldName) + "'", error); |
| 264 | + checker().withScreenshot().verifyEquals("Error message for invalid number-like alternate key not as expected", |
| 265 | + "Value '1234' was not present in lookup target 'lists." + normalizeSpace(lookToListName) |
| 266 | + + "' for field '" + normalizeSpace(labelFromName(lookFromLookupFieldName)) + "'", error); |
257 | 267 |
|
258 | 268 | } |
259 | 269 |
|
|
0 commit comments