From a53ccb0ed7c775a2e686837afe7d45f94a52bfd3 Mon Sep 17 00:00:00 2001 From: Samuel <38922357+sam94dion@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:23:29 -0400 Subject: [PATCH 1/5] fixed DB2 so that the copybooks are expanded --- .../features/interpreter/InterpreterController.java | 6 ++++-- .../openmainframeproject/cobolcheck/workers/Generator.java | 4 ++-- .../org/openmainframeproject/cobolcheck/ExpanderTest.java | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java index 6b2ee2b4..98773c07 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java @@ -154,9 +154,11 @@ public boolean shouldCurrentLineBeStubbed() throws IOException { public boolean shouldCurrentStatementBeStubbed() { for (CobolLine line : reader.getCurrentStatement()) { if (Interpreter.shouldLineBeStubbed(line, reader.getState())) { - if (!insideSectionOrParagraphMockBody && Interpreter.endsInPeriod(reader.getCurrentLine())) + if (!insideSectionOrParagraphMockBody && Interpreter.endsInPeriod(reader.getCurrentLine())) { reader.putNextLine(" ."); - reader.putNextLine(" CONTINUE"); + if (!reader.getState().isFlagSetFor(Constants.WORKING_STORAGE_SECTION)) + reader.putNextLine(" CONTINUE"); + } return true; } } diff --git a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java index d7bd7d13..50e0ed96 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java @@ -133,6 +133,8 @@ private void processingBeforeEchoingSourceLineToOutput() throws IOException { workingStorageHasEnded = true; } if (interpreter.didLineJustEnter(Constants.PROCEDURE_DIVISION) && interpreter.currentLineContains(Constants.PROCEDURE_DIVISION)){ + if (!interpreter.getFileSectionStatements().isEmpty()) + writerController.writeLines(interpreter.getFileSectionStatements()); writerController.stopStoringLines(); testSuiteParserController.parseTestSuites(interpreter.getNumericFields()); writerController.writeLines(testSuiteParserController.getWorkingStorageMockCode()); @@ -177,8 +179,6 @@ private void writeToSource(String sourceLine) throws IOException { if (interpreter.shouldCurrentLineBeStubbed()) { if(interpreter.isReading(Constants.WORKING_STORAGE_SECTION)) { writerController.writeStubbedLine(interpreter.getCurrentLineAsStatement().getUnNumberedString()); - if (!interpreter.getFileSectionStatements().isEmpty()) - writerController.writeLines(interpreter.getFileSectionStatements()); } else writerController.writeStubbedLine(sourceLine); diff --git a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java index 0d356fae..8f829116 100644 --- a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java +++ b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java @@ -66,7 +66,7 @@ void commonSetup() throws IOException { } } - @Test +/* @Test public void it_inserts_a_mock_correctly() throws IOException { String s1 = " WORKING-STORAGE SECTION."; String s2 = " EXEC SQL INCLUDE TEXEM END-EXEC."; @@ -92,7 +92,7 @@ public void it_inserts_a_mock_correctly() throws IOException { assertEquals(Utilities.getTrimmedList(expected1), actual); } - + */ @Test public void it_inserts_code_correctly_when_call_has_exception_handling_with_end_call_terminator() From 08aaa464be6431ed2abaf818291840f48bb4a30b Mon Sep 17 00:00:00 2001 From: Samuel <38922357+sam94dion@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:53:12 -0400 Subject: [PATCH 2/5] fixed test --- .../openmainframeproject/cobolcheck/ExpanderTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java index 8f829116..d57165a4 100644 --- a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java +++ b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java @@ -66,7 +66,7 @@ void commonSetup() throws IOException { } } -/* @Test + @Test public void it_inserts_a_mock_correctly() throws IOException { String s1 = " WORKING-STORAGE SECTION."; String s2 = " EXEC SQL INCLUDE TEXEM END-EXEC."; @@ -92,7 +92,7 @@ public void it_inserts_a_mock_correctly() throws IOException { assertEquals(Utilities.getTrimmedList(expected1), actual); } - */ + @Test public void it_inserts_code_correctly_when_call_has_exception_handling_with_end_call_terminator() @@ -268,13 +268,13 @@ public void it_inserts_code_correctly_when_there_are_some_unmock_calls_and_confi private String expected1 = " WORKING-STORAGE SECTION. " + Constants.NEWLINE + " *EXEC SQL INCLUDE TEXEM END-EXEC. " + Constants.NEWLINE + + " 01 FILLER. " + Constants.NEWLINE + + " 05 WS-FIELD-1 PIC X(80). " + Constants.NEWLINE + + " 05 ws-Field-2 PIC X(80). " + Constants.NEWLINE + " 01 TEXEM. " + Constants.NEWLINE + " 10 FIRST-NAME PIC X(10). " + Constants.NEWLINE + " 10 LAST-NAME PIC X(10). " + Constants.NEWLINE + " 10 TMS-CREA PIC X(26). " + Constants.NEWLINE + - " 01 FILLER. " + Constants.NEWLINE + - " 05 WS-FIELD-1 PIC X(80). " + Constants.NEWLINE + - " 05 ws-Field-2 PIC X(80). " + Constants.NEWLINE + " PROCEDURE DIVISION. " + Constants.NEWLINE + " PERFORM UT-INITIALIZE " + Constants.NEWLINE + " *============= \"Basic test\" =============* " + Constants.NEWLINE + From 7b3840e1d80498531caa8b96924cbd5b2d0a5d48 Mon Sep 17 00:00:00 2001 From: Samuel <38922357+sam94dion@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:54:17 -0400 Subject: [PATCH 3/5] Small indent problem --- .../java/org/openmainframeproject/cobolcheck/ExpanderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java index d57165a4..4acf7750 100644 --- a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java +++ b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java @@ -66,7 +66,7 @@ void commonSetup() throws IOException { } } - @Test + @Test public void it_inserts_a_mock_correctly() throws IOException { String s1 = " WORKING-STORAGE SECTION."; String s2 = " EXEC SQL INCLUDE TEXEM END-EXEC."; From 6a9bde7d1615b969b7890d8fa3002b759958846f Mon Sep 17 00:00:00 2001 From: Samuel <38922357+sam94dion@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:46:06 -0400 Subject: [PATCH 4/5] Added stuff to handle linkage section --- src/main/cobol/DB2PROG.cbl | 2 +- .../cobolcheck/workers/Generator.java | 13 ++- .../cobolcheck/ExpanderTest.java | 92 ++++++++++++++++++- 3 files changed, 101 insertions(+), 6 deletions(-) diff --git a/src/main/cobol/DB2PROG.cbl b/src/main/cobol/DB2PROG.cbl index 68ffb6b3..70028be3 100644 --- a/src/main/cobol/DB2PROG.cbl +++ b/src/main/cobol/DB2PROG.cbl @@ -20,7 +20,7 @@ DECLARE NAME-CUR CURSOR FOR SELECT FIRST_NAME, LAST_NAME FROM TEXEM END-EXEC. - + LINKAGE SECTION. PROCEDURE DIVISION. 0000-MAIN. diff --git a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java index 50e0ed96..742a3ded 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java @@ -33,6 +33,7 @@ public class Generator { private WriterController writerController; private TestSuiteParserController testSuiteParserController; private boolean workingStorageHasEnded; + private boolean linkageExist; List matchingTestDirectories; @@ -82,7 +83,8 @@ public void prepareAndRunMerge(String programName, String testFileNames) { Log.debug("Initializer.runTestSuites() testSourceOutPath: <" + testSourceOutPath + ">"); workingStorageHasEnded = false; - + linkageExist = false; + mergeTestSuite(); Log.info(Messages.get("INF012", programName)); @@ -132,14 +134,19 @@ private void processingBeforeEchoingSourceLineToOutput() throws IOException { writerController.startStoringLines(); workingStorageHasEnded = true; } - if (interpreter.didLineJustEnter(Constants.PROCEDURE_DIVISION) && interpreter.currentLineContains(Constants.PROCEDURE_DIVISION)){ - if (!interpreter.getFileSectionStatements().isEmpty()) + if (interpreter.didLineJustEnter(Constants.PROCEDURE_DIVISION) && interpreter.currentLineContains(Constants.PROCEDURE_DIVISION)) { + if (!interpreter.getFileSectionStatements().isEmpty() && !linkageExist) writerController.writeLines(interpreter.getFileSectionStatements()); writerController.stopStoringLines(); testSuiteParserController.parseTestSuites(interpreter.getNumericFields()); writerController.writeLines(testSuiteParserController.getWorkingStorageMockCode()); writerController.releaseStoredLines(); } + if (interpreter.didLineJustEnter(Constants.LINKAGE_SECTION)) { + if (!interpreter.getFileSectionStatements().isEmpty() ) + writerController.writeLines(interpreter.getFileSectionStatements()); + linkageExist = true; + } } private String tryInsertEndEvaluateAtMockedCompomentEnd(String sourceLine) throws IOException { diff --git a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java index 4acf7750..5636ccb7 100644 --- a/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java +++ b/src/test/java/org/openmainframeproject/cobolcheck/ExpanderTest.java @@ -90,9 +90,36 @@ public void it_inserts_a_mock_correctly() throws IOException { List actual = Utilities.getTrimmedList(Utilities.removeBoilerPlateCode(writer.toString(), boilerPlateTags)); - assertEquals(Utilities.getTrimmedList(expected1), actual); + assertEquals(Utilities.getTrimmedList(expected0), actual); } - + + @Test + public void it_inserts_db2_copy_linkage_correctly() throws IOException { + String s1 = " WORKING-STORAGE SECTION."; + String s2 = " EXEC SQL INCLUDE TEXEM END-EXEC."; + String s3 = " 01 FILLER."; + String s4 = " 05 WS-FIELD-1 PIC X(80)."; + String s5 = " 05 ws-Field-2 PIC X(80)."; + String s6 = " LINKAGE SECTION."; + String s7 = " PROCEDURE DIVISION."; + String s8 = " 000-START SECTION."; + String s9 = " MOVE \"Value1\" to WS-FIELD-1"; + String s10 = " EXIT SECTION"; + String s11 = " ."; + + String t1 = " TestSuite \"Basic test\""; + String t2 = " PERFORM 000-START"; + String t3 = " EXPECT WS-FIELD-1 TO BE \"Value1\""; + + Mockito.when(mockedInterpreterReader.readLine()).thenReturn(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, null); + Mockito.when(mockedParserReader.readLine()).thenReturn(t1, t2, t3, null); + + generator = new Generator(interpreterController, writerController, testSuiteParserController); + + List actual = Utilities.getTrimmedList(Utilities.removeBoilerPlateCode(writer.toString(), boilerPlateTags)); + + assertEquals(Utilities.getTrimmedList(expected1), actual); + } @Test public void it_inserts_code_correctly_when_call_has_exception_handling_with_end_call_terminator() @@ -264,6 +291,66 @@ public void it_inserts_code_correctly_when_there_are_some_unmock_calls_and_confi assertEquals(Utilities.getTrimmedList(expected8), actual); Config.changeProperty("cobolcheck.test.unmockcall.display", "true"); } +private String expected0 = + " WORKING-STORAGE SECTION. " + Constants.NEWLINE + + " *EXEC SQL INCLUDE TEXEM END-EXEC. " + Constants.NEWLINE + + " 01 FILLER. " + Constants.NEWLINE + + " 05 WS-FIELD-1 PIC X(80). " + Constants.NEWLINE + + " 05 ws-Field-2 PIC X(80). " + Constants.NEWLINE + + " 01 TEXEM. " + Constants.NEWLINE + + " 10 FIRST-NAME PIC X(10). " + Constants.NEWLINE + + " 10 LAST-NAME PIC X(10). " + Constants.NEWLINE + + " 10 TMS-CREA PIC X(26). " + Constants.NEWLINE + + " PROCEDURE DIVISION. " + Constants.NEWLINE + + " PERFORM UT-INITIALIZE " + Constants.NEWLINE + + " *============= \"Basic test\" =============* " + Constants.NEWLINE + + " DISPLAY \"TESTSUITE:\" " + Constants.NEWLINE + + " DISPLAY \"Basic test\" " + Constants.NEWLINE + + " MOVE \"Basic test\" " + Constants.NEWLINE + + " TO UT-TEST-SUITE-NAME " + Constants.NEWLINE + + " PERFORM 000-START " + Constants.NEWLINE + + " ADD 1 TO UT-TEST-CASE-COUNT " + Constants.NEWLINE + + " SET UT-NORMAL-COMPARE TO TRUE " + Constants.NEWLINE + + " SET UT-ALPHANUMERIC-COMPARE TO TRUE " + Constants.NEWLINE + + " MOVE WS-FIELD-1 TO UT-ACTUAL " + Constants.NEWLINE + + " MOVE \"Value1\" " + Constants.NEWLINE + + " TO UT-EXPECTED " + Constants.NEWLINE + + " SET UT-RELATION-EQ TO TRUE " + Constants.NEWLINE + + " PERFORM UT-CHECK-EXPECTATION " + Constants.NEWLINE + + " UT-BEFORE-EACH. " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " *This is performed before each Test Case " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " CONTINUE " + Constants.NEWLINE + + " . " + Constants.NEWLINE + + " " + Constants.NEWLINE + + " UT-AFTER-EACH. " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " *This is performed after each Test Case " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " CONTINUE " + Constants.NEWLINE + + " . " + Constants.NEWLINE + + " " + Constants.NEWLINE + + " PROCESS-UNMOCK-CALL. " + Constants.NEWLINE + + " Add 1 to UT-NUMBER-UNMOCK-CALL " + Constants.NEWLINE + + " display \"Call not mocked in testcase \" UT-TEST-CASE-NAME \" in " + Constants.NEWLINE + + " - \" testsuite \" UT-TEST-SUITE-NAME " + Constants.NEWLINE + + " display \"All used calls should be mocked, to ensure the unit " + Constants.NEWLINE + + " - \"test has control over input data\" " + Constants.NEWLINE + + " CONTINUE " + Constants.NEWLINE + + " . " + Constants.NEWLINE + + " " + Constants.NEWLINE + + " UT-INITIALIZE-MOCK-COUNT. " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " *Sets all global mock counters and expected count to 0 " + Constants.NEWLINE + + " ***************************************************************** " + Constants.NEWLINE + + " CONTINUE " + Constants.NEWLINE + + " . " + Constants.NEWLINE + + " " + Constants.NEWLINE + + " 000-START SECTION. " + Constants.NEWLINE + + " MOVE \"Value1\" to WS-FIELD-1 " + Constants.NEWLINE + + " EXIT SECTION " + Constants.NEWLINE + + " . "; private String expected1 = " WORKING-STORAGE SECTION. " + Constants.NEWLINE + @@ -275,6 +362,7 @@ public void it_inserts_code_correctly_when_there_are_some_unmock_calls_and_confi " 10 FIRST-NAME PIC X(10). " + Constants.NEWLINE + " 10 LAST-NAME PIC X(10). " + Constants.NEWLINE + " 10 TMS-CREA PIC X(26). " + Constants.NEWLINE + + " LINKAGE SECTION. " + Constants.NEWLINE + " PROCEDURE DIVISION. " + Constants.NEWLINE + " PERFORM UT-INITIALIZE " + Constants.NEWLINE + " *============= \"Basic test\" =============* " + Constants.NEWLINE + From 9010b8114edd9d1bec51e498e520638b835f99a0 Mon Sep 17 00:00:00 2001 From: Samuel Date: Fri, 27 Oct 2023 16:27:27 -0400 Subject: [PATCH 5/5] Added new function to better represent what's its doing Added sqlCopyBookStatement to better represent that what is happening. When reading SQL statement which are copybook. They are then expanded and stored within the sqlCopyBookStatement variable. --- .../interpreter/InterpreterController.java | 4 ++++ .../features/interpreter/LineRepository.java | 19 +++++++++++++++++- .../cobolcheck/workers/Generator.java | 8 ++++---- .../cobolcheck/InterpreterControllerTest.java | 20 +++++++++---------- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java index 98773c07..0a4abf78 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java @@ -53,6 +53,10 @@ public List getFileControlStatements() { return lineRepository.getFileControlStatements(); } + public List getSqlCopyBookStatements() { + return lineRepository.getSqlCopyBookStatement(); + } + public Map getFileIdentifiersAndStatuses() { return lineRepository.getFileIdentifiersAndStatuses(); } diff --git a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/LineRepository.java b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/LineRepository.java index 6f332ab3..b51b4834 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/LineRepository.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/LineRepository.java @@ -24,6 +24,9 @@ public class LineRepository { // All lines from original Data Division / File Section private List fileSectionStatements; + // All lines from DB2 Copybooks + private List sqlCopyBookStatement; + // Internal file identifiers and status field names private final Map fileIdentifiersAndStatuses; @@ -32,6 +35,7 @@ public class LineRepository { LineRepository() { fileSectionStatements = new ArrayList<>(); + sqlCopyBookStatement = new ArrayList<>(); this.fileIdentifiersAndStatuses = new HashMap<>(); } @@ -43,6 +47,10 @@ List getFileSectionStatements() { return fileSectionStatements; } + List getSqlCopyBookStatement() { + return sqlCopyBookStatement; + } + Map getFileIdentifiersAndStatuses() { return fileIdentifiersAndStatuses; } @@ -67,14 +75,23 @@ void addFileSectionStatement(String statement){ } fileSectionStatements.add(statement); } + + void addsqlCopyBookStatement(String statement){ + if (sqlCopyBookStatement == null){ + sqlCopyBookStatement = new ArrayList<>(); + } + sqlCopyBookStatement.add(statement); + } void putFileIdentifierAndStatus(String key, String value){ fileIdentifiersAndStatuses.put(key, value); } + void addFileIdentifierWithNoStatus(String identifier){ fileIdentifiersAndStatuses.put(identifier, Constants.EMPTY_STRING); currentExpectFileIdentifier = identifier; } + void addStatusForLastSetIdentifier(String status){ fileIdentifiersAndStatuses.put(currentExpectFileIdentifier, status); } @@ -144,7 +161,7 @@ List addExpandedCopyDB2Statements(CobolLine line) throws IOException { } catch (IOException ioEx) { throw new CopybookCouldNotBeExpanded(ioEx); } - fileSectionStatements.addAll(copyLines); + sqlCopyBookStatement.addAll(copyLines); return copyLines; } } diff --git a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java index 742a3ded..706a60d2 100644 --- a/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java +++ b/src/main/java/org/openmainframeproject/cobolcheck/workers/Generator.java @@ -135,16 +135,16 @@ private void processingBeforeEchoingSourceLineToOutput() throws IOException { workingStorageHasEnded = true; } if (interpreter.didLineJustEnter(Constants.PROCEDURE_DIVISION) && interpreter.currentLineContains(Constants.PROCEDURE_DIVISION)) { - if (!interpreter.getFileSectionStatements().isEmpty() && !linkageExist) - writerController.writeLines(interpreter.getFileSectionStatements()); + if (!interpreter.getSqlCopyBookStatements().isEmpty() && !linkageExist) + writerController.writeLines(interpreter.getSqlCopyBookStatements()); writerController.stopStoringLines(); testSuiteParserController.parseTestSuites(interpreter.getNumericFields()); writerController.writeLines(testSuiteParserController.getWorkingStorageMockCode()); writerController.releaseStoredLines(); } if (interpreter.didLineJustEnter(Constants.LINKAGE_SECTION)) { - if (!interpreter.getFileSectionStatements().isEmpty() ) - writerController.writeLines(interpreter.getFileSectionStatements()); + if (!interpreter.getSqlCopyBookStatements().isEmpty() ) + writerController.writeLines(interpreter.getSqlCopyBookStatements()); linkageExist = true; } } diff --git a/src/test/java/org/openmainframeproject/cobolcheck/InterpreterControllerTest.java b/src/test/java/org/openmainframeproject/cobolcheck/InterpreterControllerTest.java index 20dd88ce..b2330cf3 100644 --- a/src/test/java/org/openmainframeproject/cobolcheck/InterpreterControllerTest.java +++ b/src/test/java/org/openmainframeproject/cobolcheck/InterpreterControllerTest.java @@ -890,11 +890,11 @@ public void it_adds_file_section_statements_from_source_and_db2copybook_multiple interpreterController.interpretNextLine(); } - assertEquals(4,interpreterController.getFileSectionStatements().size()); - assertTrue(interpreterController.getFileSectionStatements().contains(" 01 TEXEM.")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 FIRST-NAME PIC X(10).")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 LAST-NAME PIC X(10).")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 TMS-CREA PIC X(26).")); + assertEquals(4,interpreterController.getSqlCopyBookStatements().size()); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 01 TEXEM.")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 FIRST-NAME PIC X(10).")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 LAST-NAME PIC X(10).")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 TMS-CREA PIC X(26).")); } @Test @@ -910,11 +910,11 @@ public void it_adds_file_section_statements_from_source_and_db2copybook() throws interpreterController.interpretNextLine(); } - assertEquals(4,interpreterController.getFileSectionStatements().size()); - assertTrue(interpreterController.getFileSectionStatements().contains(" 01 TEXEM.")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 FIRST-NAME PIC X(10).")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 LAST-NAME PIC X(10).")); - assertTrue(interpreterController.getFileSectionStatements().contains(" 10 TMS-CREA PIC X(26).")); + assertEquals(4,interpreterController.getSqlCopyBookStatements().size()); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 01 TEXEM.")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 FIRST-NAME PIC X(10).")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 LAST-NAME PIC X(10).")); + assertTrue(interpreterController.getSqlCopyBookStatements().contains(" 10 TMS-CREA PIC X(26).")); } @Test