From ed3fc46170a942821fad22c7fde80752eb1d45de Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Tue, 31 Jul 2018 15:49:38 +0200 Subject: [PATCH 1/8] Add passing tests and test duration --- .../logstash/persistence/BuildData.java | 39 +++++++++++++---- .../plugins/logstash/LogstashWriterTest.java | 2 + .../logstash/persistence/BuildDataTest.java | 43 +++++++++++++++++-- 3 files changed, 72 insertions(+), 12 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index d96cec29..f3bb1c4d 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -67,15 +67,20 @@ public class BuildData { private final static Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass().getCanonicalName()); public static class TestData { private int totalCount, skipCount, failCount, passCount; - private List failedTestsWithErrorDetail; + private List failedTestsWithDetail; private List failedTests; - public static class FailedTest { + private List passedTestsWithDetail; + private List passedTests; + + public static class ExecutedTest { private final String fullName, errorDetails; - public FailedTest(String fullName, String errorDetails) { + private final float duration; + public ExecutedTest(String fullName, String errorDetails, float duration) { super(); this.fullName = fullName; this.errorDetails = errorDetails; + this.duration = duration; } public String getFullName() @@ -102,7 +107,8 @@ public TestData(Action action) { if (testResultAction == null) { totalCount = skipCount = failCount = 0; failedTests = Collections.emptyList(); - failedTestsWithErrorDetail = Collections.emptyList(); + failedTestsWithDetail = Collections.emptyList(); + passedTestsWithDetail = Collections.emptyList(); return; } @@ -112,10 +118,17 @@ public TestData(Action action) { passCount = totalCount - skipCount - failCount; failedTests = new ArrayList(); - failedTestsWithErrorDetail = new ArrayList(); + failedTestsWithDetail = new ArrayList(); for (TestResult result : testResultAction.getFailedTests()) { failedTests.add(result.getFullName()); - failedTestsWithErrorDetail.add(new FailedTest(result.getFullName(),result.getErrorDetails())); + failedTestsWithDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); + } + + passedTests = new ArrayList(); + passedTestsWithDetail = new ArrayList(); + for (TestResult result : testResultAction.getPassedTests()) { + passedTests.add(result.getFullName()); + passedTestsWithDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); } } @@ -139,9 +152,19 @@ public int getPassCount() return passCount; } - public List getFailedTestsWithErrorDetail() + public List getFailedTestsWithDetail() + { + return failedTestsWithDetail; + } + + public List getPassedTestsWithDetail() + { + return passedTestsWithDetail; + } + + public List getPassedTests() { - return failedTestsWithErrorDetail; + return passedTests; } public List getFailedTests() diff --git a/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java b/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java index 36c54a95..89de9b85 100644 --- a/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java +++ b/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java @@ -128,6 +128,7 @@ public void before() throws Exception { when(mockTestResultAction.getTotalCount()).thenReturn(0); when(mockTestResultAction.getSkipCount()).thenReturn(0); when(mockTestResultAction.getFailCount()).thenReturn(0); + when(mockTestResultAction.getPassedTests()).thenReturn(Collections.emptyList()); when(mockTestResultAction.getFailedTests()).thenReturn(Collections.emptyList()); when(mockProject.getName()).thenReturn("LogstashWriterTest"); @@ -182,6 +183,7 @@ public void constructorSuccess() throws Exception { verify(mockTestResultAction).getSkipCount(); verify(mockTestResultAction).getFailCount(); verify(mockTestResultAction, times(1)).getFailedTests(); + verify(mockTestResultAction, times(1)).getPassedTests(); verify(mockProject, times(2)).getName(); verify(mockProject, times(2)).getFullName(); diff --git a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java index 2a9b8e60..92fedf3a 100644 --- a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java +++ b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java @@ -59,7 +59,8 @@ public class BuildDataTest { + "\"rootProjectName\":\"RootBuildDataTest\",\"rootFullProjectName\":\"parent/RootBuildDataTest\"," + "\"rootProjectDisplayName\":\"Root BuildData Test\",\"rootBuildNum\":456,\"buildVariables\":{}," + "\"sensitiveBuildVariables\":[],\"testResults\":{\"totalCount\":0,\"skipCount\":0,\"failCount\":0, \"passCount\":0," - + "\"failedTests\":[], \"failedTestsWithErrorDetail\":[]}}"; + + "\"passedTests\":[], \"passedTestsWithDetail\":[]," + + "\"failedTests\":[], \"failedTestsWithDetail\":[]}}"; @Mock AbstractBuild mockBuild; @Mock AbstractBuild mockRootBuild; @@ -99,6 +100,7 @@ public void before() throws Exception { when(mockTestResultAction.getTotalCount()).thenReturn(0); when(mockTestResultAction.getSkipCount()).thenReturn(0); when(mockTestResultAction.getFailCount()).thenReturn(0); + when(mockTestResultAction.getPassedTests()).thenReturn(Collections.emptyList()); when(mockTestResultAction.getFailedTests()).thenReturn(Collections.emptyList()); when(mockProject.getName()).thenReturn("BuildDataTest"); @@ -166,6 +168,7 @@ private void verifyTestResultActions() { verify(mockTestResultAction).getTotalCount(); verify(mockTestResultAction).getSkipCount(); verify(mockTestResultAction).getFailCount(); + verify(mockTestResultAction, times(1)).getPassedTests(); verify(mockTestResultAction, times(1)).getFailedTests(); } @@ -247,6 +250,7 @@ public void constructorSuccessTestFailures() throws Exception { when(mockTestResultAction.getSkipCount()).thenReturn(0); when(mockTestResultAction.getFailCount()).thenReturn(1); when(mockTestResultAction.getFailedTests()).thenReturn(Arrays.asList(mockTestResult)); + when(mockTestResultAction.getPassedTests()).thenReturn(Arrays.asList(mockTestResult)); // Unit under test BuildData buildData = new BuildData(mockBuild, mockDate, mockListener); @@ -256,9 +260,40 @@ public void constructorSuccessTestFailures() throws Exception { Assert.assertEquals("Incorrect test results", 123, testResults.getTotalCount()); Assert.assertEquals("Incorrect test results", 0, testResults.getSkipCount()); Assert.assertEquals("Incorrect test results", 1, testResults.getFailCount()); - Assert.assertEquals("Incorrect test details count", 1, testResults.getFailedTestsWithErrorDetail().size()); - Assert.assertEquals("Incorrect failed test error details", "ErrorDetails Test", testResults.getFailedTestsWithErrorDetail().get(0).getErrorDetails()); - Assert.assertEquals("Incorrect failed test fullName", "Mock Full Test", testResults.getFailedTestsWithErrorDetail().get(0).getFullName()); + Assert.assertEquals("Incorrect test details count", 1, testResults.getFailedTestsWithDetail().size()); + Assert.assertEquals("Incorrect failed test error details", "ErrorDetails Test", testResults.getFailedTestsWithDetail().get(0).getErrorDetails()); + Assert.assertEquals("Incorrect failed test fullName", "Mock Full Test", testResults.getFailedTestsWithDetail().get(0).getFullName()); + + + verifyMocks(); + verifyTestResultActions(); + } + + @Test + public void constructorSuccessTestPasses() throws Exception { + TestResult mockTestResult = Mockito.mock(hudson.tasks.test.TestResult.class); + when(mockTestResult.getFullName()).thenReturn("Mock Full Test"); + when(mockTestResult.getErrorDetails()).thenReturn(""); + + when(mockTestResultAction.getTotalCount()).thenReturn(123); + when(mockTestResultAction.getSkipCount()).thenReturn(0); + when(mockTestResultAction.getFailCount()).thenReturn(0); + when(mockTestResultAction.getFailedTests()).thenReturn(Arrays.asList(mockTestResult)); + when(mockTestResultAction.getPassedTests()).thenReturn(Arrays.asList(mockTestResult)); + + // Unit under test + BuildData buildData = new BuildData(mockBuild, mockDate, mockListener); + + TestData testResults = buildData.getTestResults(); + + Assert.assertEquals("Incorrect test results", 123, testResults.getTotalCount()); + Assert.assertEquals("Incorrect test results", 0, testResults.getSkipCount()); + Assert.assertEquals("Incorrect test results", 0, testResults.getFailCount()); + Assert.assertEquals("Incorrect test results", 123, testResults.getPassCount()); + Assert.assertEquals("Incorrect test details count", 1, testResults.getFailedTestsWithDetail().size()); + Assert.assertEquals("Incorrect failed test error details", "", testResults.getPassedTestsWithDetail().get(0).getErrorDetails()); + Assert.assertEquals("Incorrect failed test fullName", "Mock Full Test", testResults.getPassedTestsWithDetail().get(0).getFullName()); + verifyMocks(); verifyTestResultActions(); From 82c1b7bb275d1291ba2a3c60cd6534e7a9ae96b3 Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Tue, 7 Aug 2018 11:58:58 +0200 Subject: [PATCH 2/8] Reverted failedTestsWithErrorDetail name --- .../plugins/logstash/persistence/BuildData.java | 10 +++++----- .../plugins/logstash/persistence/BuildDataTest.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index f3bb1c4d..197e2f95 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -67,7 +67,7 @@ public class BuildData { private final static Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass().getCanonicalName()); public static class TestData { private int totalCount, skipCount, failCount, passCount; - private List failedTestsWithDetail; + private List failedTestsWithErrorDetail; private List failedTests; private List passedTestsWithDetail; @@ -107,7 +107,7 @@ public TestData(Action action) { if (testResultAction == null) { totalCount = skipCount = failCount = 0; failedTests = Collections.emptyList(); - failedTestsWithDetail = Collections.emptyList(); + failedTestsWithErrorDetail = Collections.emptyList(); passedTestsWithDetail = Collections.emptyList(); return; } @@ -118,10 +118,10 @@ public TestData(Action action) { passCount = totalCount - skipCount - failCount; failedTests = new ArrayList(); - failedTestsWithDetail = new ArrayList(); + failedTestsWithErrorDetail = new ArrayList(); for (TestResult result : testResultAction.getFailedTests()) { failedTests.add(result.getFullName()); - failedTestsWithDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); + failedTestsWithErrorDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); } passedTests = new ArrayList(); @@ -154,7 +154,7 @@ public int getPassCount() public List getFailedTestsWithDetail() { - return failedTestsWithDetail; + return failedTestsWithErrorDetail; } public List getPassedTestsWithDetail() diff --git a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java index 92fedf3a..3ca04d95 100644 --- a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java +++ b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java @@ -60,7 +60,7 @@ public class BuildDataTest { + "\"rootProjectDisplayName\":\"Root BuildData Test\",\"rootBuildNum\":456,\"buildVariables\":{}," + "\"sensitiveBuildVariables\":[],\"testResults\":{\"totalCount\":0,\"skipCount\":0,\"failCount\":0, \"passCount\":0," + "\"passedTests\":[], \"passedTestsWithDetail\":[]," - + "\"failedTests\":[], \"failedTestsWithDetail\":[]}}"; + + "\"failedTests\":[], \"failedTestsWithErrorDetail\":[]}}"; @Mock AbstractBuild mockBuild; @Mock AbstractBuild mockRootBuild; From 58233d6b45a17b80a902bb9a9f2888b6484ed82d Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Tue, 7 Aug 2018 17:33:33 +0200 Subject: [PATCH 3/8] Add testListFill function --- .../plugins/logstash/persistence/BuildData.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index 197e2f95..2b5deb6b 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -119,16 +119,17 @@ public TestData(Action action) { failedTests = new ArrayList(); failedTestsWithErrorDetail = new ArrayList(); - for (TestResult result : testResultAction.getFailedTests()) { - failedTests.add(result.getFullName()); - failedTestsWithErrorDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); - } + testListFill((List) testResultAction.getFailedTests(), failedTests, failedTestsWithErrorDetail); passedTests = new ArrayList(); passedTestsWithDetail = new ArrayList(); - for (TestResult result : testResultAction.getPassedTests()) { - passedTests.add(result.getFullName()); - passedTestsWithDetail.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); + testListFill((List) testResultAction.getPassedTests(), passedTests, passedTestsWithDetail); + } + + private void testListFill(List testResults, List testNames, List testDetails) { + for (TestResult result : testResults) { + testNames.add(result.getFullName()); + testDetails.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); } } From 8975d82924768325815c9a36d95cfc206c1dcfbf Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Tue, 7 Aug 2018 17:34:16 +0200 Subject: [PATCH 4/8] Change passedTestWithDetail to passedTestWithErrorDetail for consistency --- .../plugins/logstash/persistence/BuildData.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index 2b5deb6b..1246461e 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -70,7 +70,7 @@ public static class TestData { private List failedTestsWithErrorDetail; private List failedTests; - private List passedTestsWithDetail; + private List passedTestsWithErrorDetail; private List passedTests; public static class ExecutedTest { @@ -108,7 +108,7 @@ public TestData(Action action) { totalCount = skipCount = failCount = 0; failedTests = Collections.emptyList(); failedTestsWithErrorDetail = Collections.emptyList(); - passedTestsWithDetail = Collections.emptyList(); + passedTestsWithErrorDetail = Collections.emptyList(); return; } @@ -122,8 +122,8 @@ public TestData(Action action) { testListFill((List) testResultAction.getFailedTests(), failedTests, failedTestsWithErrorDetail); passedTests = new ArrayList(); - passedTestsWithDetail = new ArrayList(); - testListFill((List) testResultAction.getPassedTests(), passedTests, passedTestsWithDetail); + passedTestsWithErrorDetail = new ArrayList(); + testListFill((List) testResultAction.getPassedTests(), passedTests, passedTestsWithErrorDetail); } private void testListFill(List testResults, List testNames, List testDetails) { @@ -160,7 +160,7 @@ public List getFailedTestsWithDetail() public List getPassedTestsWithDetail() { - return passedTestsWithDetail; + return passedTestsWithErrorDetail; } public List getPassedTests() From 685437ee537c975ca6b7ea3a80b89f5a20f26ab2 Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Wed, 8 Aug 2018 09:32:36 +0200 Subject: [PATCH 5/8] Fix failing test --- .../jenkins/plugins/logstash/persistence/BuildDataTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java index 3ca04d95..379642ce 100644 --- a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java +++ b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java @@ -59,7 +59,7 @@ public class BuildDataTest { + "\"rootProjectName\":\"RootBuildDataTest\",\"rootFullProjectName\":\"parent/RootBuildDataTest\"," + "\"rootProjectDisplayName\":\"Root BuildData Test\",\"rootBuildNum\":456,\"buildVariables\":{}," + "\"sensitiveBuildVariables\":[],\"testResults\":{\"totalCount\":0,\"skipCount\":0,\"failCount\":0, \"passCount\":0," - + "\"passedTests\":[], \"passedTestsWithDetail\":[]," + + "\"passedTests\":[], \"passedTestsWithErrorDetail\":[]," + "\"failedTests\":[], \"failedTestsWithErrorDetail\":[]}}"; @Mock AbstractBuild mockBuild; From 069e31c1bbefc4aad1c28d535dc5fa920c300c6a Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Wed, 8 Aug 2018 12:05:57 +0200 Subject: [PATCH 6/8] Set empty List for passedTests when testResultAction is null --- .../java/jenkins/plugins/logstash/persistence/BuildData.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index 1246461e..5b21c729 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -108,6 +108,7 @@ public TestData(Action action) { totalCount = skipCount = failCount = 0; failedTests = Collections.emptyList(); failedTestsWithErrorDetail = Collections.emptyList(); + passedTests = Collections.emptyList(); passedTestsWithErrorDetail = Collections.emptyList(); return; } From 51c51eafdd368c64225e165ab7b74dbc78675135 Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Fri, 10 Aug 2018 14:46:13 +0200 Subject: [PATCH 7/8] Intermediate version with global setting to disable passing test recording. Tests updated to remove references to getPassingTests --- .../plugins/logstash/LogstashConfiguration.java | 11 +++++++++++ .../plugins/logstash/persistence/BuildData.java | 12 +++++++++--- .../logstash/LogstashConfiguration/config.jelly | 3 +++ .../jenkins/plugins/logstash/LogstashWriterTest.java | 1 - .../plugins/logstash/persistence/BuildDataTest.java | 5 ----- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java b/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java index 613d7f6a..53c955b4 100644 --- a/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java +++ b/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java @@ -42,6 +42,7 @@ public class LogstashConfiguration extends GlobalConfiguration private Boolean enabled; private boolean dataMigrated = false; private boolean enableGlobally = false; + private boolean recordingPassingTests = false; private boolean milliSecondTimestamps = true; private transient LogstashIndexer activeIndexer; @@ -82,6 +83,16 @@ public void setEnableGlobally(boolean enableGlobally) this.enableGlobally = enableGlobally; } + public void setrecordingPassingTests(boolean recordingPassingTests) + { + this.recordingPassingTests = recordingPassingTests; + } + + public boolean isrecordingPassingTests() + { + return recordingPassingTests; + } + public boolean isMilliSecondTimestamps() { return milliSecondTimestamps; diff --git a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java index 5b21c729..bee86191 100644 --- a/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java +++ b/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java @@ -122,9 +122,15 @@ public TestData(Action action) { failedTestsWithErrorDetail = new ArrayList(); testListFill((List) testResultAction.getFailedTests(), failedTests, failedTestsWithErrorDetail); - passedTests = new ArrayList(); - passedTestsWithErrorDetail = new ArrayList(); - testListFill((List) testResultAction.getPassedTests(), passedTests, passedTestsWithErrorDetail); + LogstashConfiguration configuration = LogstashConfiguration.getInstance(); + if (configuration.isrecordingPassingTests()) { + passedTests = new ArrayList(); + passedTestsWithErrorDetail = new ArrayList(); + testListFill((List) testResultAction.getPassedTests(), passedTests, passedTestsWithErrorDetail); + } else { + passedTests = Collections.emptyList(); + passedTestsWithErrorDetail = Collections.emptyList(); + } } private void testListFill(List testResults, List testNames, List testDetails) { diff --git a/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly b/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly index 1ad826e2..3d0d4ed2 100644 --- a/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly +++ b/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly @@ -7,6 +7,9 @@ + + + diff --git a/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java b/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java index 89de9b85..c00b9ef3 100644 --- a/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java +++ b/src/test/java/jenkins/plugins/logstash/LogstashWriterTest.java @@ -183,7 +183,6 @@ public void constructorSuccess() throws Exception { verify(mockTestResultAction).getSkipCount(); verify(mockTestResultAction).getFailCount(); verify(mockTestResultAction, times(1)).getFailedTests(); - verify(mockTestResultAction, times(1)).getPassedTests(); verify(mockProject, times(2)).getName(); verify(mockProject, times(2)).getFullName(); diff --git a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java index 379642ce..ccfd9d22 100644 --- a/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java +++ b/src/test/java/jenkins/plugins/logstash/persistence/BuildDataTest.java @@ -168,7 +168,6 @@ private void verifyTestResultActions() { verify(mockTestResultAction).getTotalCount(); verify(mockTestResultAction).getSkipCount(); verify(mockTestResultAction).getFailCount(); - verify(mockTestResultAction, times(1)).getPassedTests(); verify(mockTestResultAction, times(1)).getFailedTests(); } @@ -279,7 +278,6 @@ public void constructorSuccessTestPasses() throws Exception { when(mockTestResultAction.getSkipCount()).thenReturn(0); when(mockTestResultAction.getFailCount()).thenReturn(0); when(mockTestResultAction.getFailedTests()).thenReturn(Arrays.asList(mockTestResult)); - when(mockTestResultAction.getPassedTests()).thenReturn(Arrays.asList(mockTestResult)); // Unit under test BuildData buildData = new BuildData(mockBuild, mockDate, mockListener); @@ -291,9 +289,6 @@ public void constructorSuccessTestPasses() throws Exception { Assert.assertEquals("Incorrect test results", 0, testResults.getFailCount()); Assert.assertEquals("Incorrect test results", 123, testResults.getPassCount()); Assert.assertEquals("Incorrect test details count", 1, testResults.getFailedTestsWithDetail().size()); - Assert.assertEquals("Incorrect failed test error details", "", testResults.getPassedTestsWithDetail().get(0).getErrorDetails()); - Assert.assertEquals("Incorrect failed test fullName", "Mock Full Test", testResults.getPassedTestsWithDetail().get(0).getFullName()); - verifyMocks(); verifyTestResultActions(); From 6932b515496d0650584de48c29da6c2162bb6602 Mon Sep 17 00:00:00 2001 From: Eugene Davis Date: Fri, 10 Aug 2018 15:13:44 +0200 Subject: [PATCH 8/8] Minor corrections to LogstashConfiguration --- .../java/jenkins/plugins/logstash/LogstashConfiguration.java | 4 ++-- .../plugins/logstash/LogstashConfiguration/config.jelly | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java b/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java index 53c955b4..a8e88ded 100644 --- a/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java +++ b/src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java @@ -83,12 +83,12 @@ public void setEnableGlobally(boolean enableGlobally) this.enableGlobally = enableGlobally; } - public void setrecordingPassingTests(boolean recordingPassingTests) + public void setRecordingPassingTests(boolean recordingPassingTests) { this.recordingPassingTests = recordingPassingTests; } - public boolean isrecordingPassingTests() + public boolean isRecordingPassingTests() { return recordingPassingTests; } diff --git a/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly b/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly index 3d0d4ed2..5640d3f5 100644 --- a/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly +++ b/src/main/resources/jenkins/plugins/logstash/LogstashConfiguration/config.jelly @@ -8,7 +8,7 @@ - +