From 5b386c1ace9d0820311df3ef743ccbf906a352ea Mon Sep 17 00:00:00 2001
From: Sagun15 <1rn19cs123.sagun@gmail.com>
Date: Wed, 5 Jul 2023 17:22:13 +0530
Subject: [PATCH 1/3] Changed README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 030906f..0b12c94 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
# Spring-Jenkins
-## Testing jenkins hooks
\ No newline at end of file
+## Testing jenkins hooks!!
\ No newline at end of file
From f9c446226790ed5593c68d30a7ee75174f1d5351 Mon Sep 17 00:00:00 2001
From: Sagun15 <1rn19cs123.sagun@gmail.com>
Date: Wed, 5 Jul 2023 17:34:54 +0530
Subject: [PATCH 2/3] Readme updated for post-push
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0b12c94..030906f 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
# Spring-Jenkins
-## Testing jenkins hooks!!
\ No newline at end of file
+## Testing jenkins hooks
\ No newline at end of file
From 92922cb15f5e6c3c743b8d465c76d2bfd922e1c6 Mon Sep 17 00:00:00 2001
From: Sagun15 <1rn19cs123.sagun@gmail.com>
Date: Thu, 6 Jul 2023 22:49:03 +0530
Subject: [PATCH 3/3] Jacoco code coverage plugin testing
---
README.md | 2 +-
pom.xml | 48 +++++++++++++++++++
.../com/example/demo/DemoApplication.java | 12 +++++
.../example/demo/DemoApplicationTests.java | 37 ++++++++++++++
4 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 030906f..0b12c94 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
# Spring-Jenkins
-## Testing jenkins hooks
\ No newline at end of file
+## Testing jenkins hooks!!
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9032554..1e97d8c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,6 +27,34 @@
spring-boot-starter-test
test
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.10
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
@@ -35,6 +63,26 @@
org.springframework.boot
spring-boot-maven-plugin
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.10
+
+
+ prepare-agent
+
+ prepare-agent
+
+
+
+ report
+ prepare-package
+
+ report
+
+
+
+
diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java
index 64b538a..966e88b 100644
--- a/src/main/java/com/example/demo/DemoApplication.java
+++ b/src/main/java/com/example/demo/DemoApplication.java
@@ -6,8 +6,20 @@
@SpringBootApplication
public class DemoApplication {
+ public static boolean isPalindrome(String inputString) {
+ if (inputString.length() == 0) {
+ return true;
+ } else {
+ char firstChar = inputString.charAt(0);
+ char lastChar = inputString.charAt(inputString.length() - 1);
+ String mid = inputString.substring(1, inputString.length() - 1);
+ return (firstChar == lastChar) && isPalindrome(mid);
+ }
+ }
+
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
+ isPalindrome("Noon");
}
}
diff --git a/src/test/java/com/example/demo/DemoApplicationTests.java b/src/test/java/com/example/demo/DemoApplicationTests.java
index 2778a6a..0ccf797 100644
--- a/src/test/java/com/example/demo/DemoApplicationTests.java
+++ b/src/test/java/com/example/demo/DemoApplicationTests.java
@@ -1,11 +1,48 @@
package com.example.demo;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
+ @Test
+ public void testIsPalindrome() {
+ // Arrange
+ String palindrome = "Noon";
+
+ // Act
+ boolean result = DemoApplication.isPalindrome(palindrome);
+
+ // Assert
+ Assertions.assertFalse(result);
+ }
+
+ @Test
+ public void whenPalindrom_thenAccept() {
+ // Arrange
+ String palindrome = "noon";
+
+ // Act
+ boolean result = DemoApplication.isPalindrome(palindrome);
+
+ // Assert
+ Assertions.assertTrue(result);
+ }
+
+ @Test
+ public void whenNearPalindrom_thenReject(){
+ // Arrange
+ String palindrome = "neon";
+
+ // Act
+ boolean result = DemoApplication.isPalindrome(palindrome);
+
+ // Assert
+ Assertions.assertFalse(result);
+ }
+
@Test
void contextLoads() {
}