From 051fcebef77e7f8c4536ef717a78f05ab1a002ff Mon Sep 17 00:00:00 2001 From: Francis Toth Date: Thu, 18 Jun 2020 15:30:26 -0400 Subject: Decouple TXT Report file writing and formatting logic (3/6) This commit aims to move the printValidationTaskStatus function's logic from ReportManager (deprecated) to ReportFile. Signed-off-by: Francis Toth Change-Id: Ic33a519f4c70276d404a83bf7de8a27f0007b285 Issue-ID: SDC-2499 --- .../asdctool/impl/validator/utils/ReportManagerTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'asdctool/src/test') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java index 479421e118..9a237af812 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManagerTest.java @@ -72,7 +72,7 @@ public class ReportManagerTest { .csvReportFilePath(resourcePath, System::currentTimeMillis); private final static String txtReportFilePath = ValidationConfigManager.txtReportFilePath(resourcePath); - private GraphVertex vertexScanned = Mockito.mock(GraphVertex.class); + private final GraphVertex vertexScanned = Mockito.mock(GraphVertex.class); @BeforeEach public void setup() { @@ -127,16 +127,16 @@ public class ReportManagerTest { when(vertexScanned.getUniqueId()).thenReturn(UNIQUE_ID); // when - ReportManager.printValidationTaskStatus(vertexScanned, TASK_1_NAME, false, txtReportFilePath); - - List reportOutputFile = ReportManagerHelper.getReportOutputFileAsList(txtReportFilePath); + List reportTxtFile = ReportFileNioHelper.withTxtFile(txtReportFilePath, file -> { + file.printValidationTaskStatus(vertexScanned, TASK_1_NAME, false); + return ReportFileNioHelper.readFileAsList(txtReportFilePath); + }); // then - assertNotNull(reportOutputFile); - - assertEquals(EXPECTED_OUTPUT_FILE_HEADER, reportOutputFile.get(0)); + assertNotNull(reportTxtFile); + assertEquals(EXPECTED_OUTPUT_FILE_HEADER, reportTxtFile.get(0)); assertEquals("-----------------------Vertex: " + UNIQUE_ID + ", Task " + TASK_1_NAME - + " failed-----------------------", reportOutputFile.get(2)); + + " failed-----------------------", reportTxtFile.get(2)); } @Test -- cgit 1.2.3-korg