Skip to content

Fix for testUpdateAndDeleteWithCommentsAndFlags#3004

Open
DariaBod wants to merge 2 commits into
developfrom
fb_fixTestUpdateAndDeleteST
Open

Fix for testUpdateAndDeleteWithCommentsAndFlags#3004
DariaBod wants to merge 2 commits into
developfrom
fb_fixTestUpdateAndDeleteST

Conversation

@DariaBod
Copy link
Copy Markdown
Contributor

Rationale

Test failed because of wrong " processing. Also was filed issue because of silent operation fails in the app.

Related Pull Requests

Changes

Copy link
Copy Markdown
Member

@labkey-tchad labkey-tchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using TestDataUtils

Comment on lines 969 to 979
List<String> fileData = new ArrayList<>();
fileData.add(String.format("%s\t%s", "Name", field01.getLabel()));
fileData.add(CSVFormat.TDF.format("Name", field01.getLabel()));
for(Map<String, String> sample : sampleData)
{
fileData.add(String.format("%s\t%s", sample.get("Name"), sample.get(field01.getName())));
fileData.add(CSVFormat.TDF.format(sample.get("Name"), sample.get(field01.getName())));
}

String fileName = "SampleTypeTest_UpdateSamples.tsv";
if (!TestFileUtils.getTestTempDir().exists())
TestFileUtils.getTestTempDir().mkdirs();
File importFile = TestFileUtils.writeTempFile(fileName, String.join(System.lineSeparator(), fileData));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the dedicated helper methods from TestDataUtils instead of having individual tests deal with file formatting.

List<Map<String, Object>> fileData = new ArrayList<>();
for(Map<String, String> sample : sampleData)
{
    fileData.add(Map.of(sample.get("Name"), sample.get(field01.getName())));
}

String fileName = "SampleTypeTest_UpdateSamples.tsv";
File importFile = TestDataUtils.writeDataToFile(fileName, fileData);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants