Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Spring-Jenkins
## Testing jenkins hooks
## Testing jenkins hooks!!
48 changes: 48 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,34 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -35,6 +63,26 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/example/demo/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}
37 changes: 37 additions & 0 deletions src/test/java/com/example/demo/DemoApplicationTests.java
Original file line number Diff line number Diff line change
@@ -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() {
}
Expand Down