Skip to content

Commit cd5d907

Browse files
committed
init
1 parent e3f0374 commit cd5d907

137 files changed

Lines changed: 8465 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

section-01-java-fundamentals/demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

section-01-java-fundamentals/helloworld/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

section-02-conditionals/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

section-03-loops/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

section-04-methods/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

section-05-arrays/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>22</maven.compiler.source>
13-
<maven.compiler.target>22</maven.compiler.target>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
</properties>
1616

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.luv2code</groupId>
8+
<artifactId>junitdemo</artifactId>
9+
<version>1.0</version>
10+
11+
<properties>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
14+
</properties>
15+
16+
<dependencies>
17+
18+
<dependency>
19+
<groupId>org.junit.jupiter</groupId>
20+
<artifactId>junit-jupiter</artifactId>
21+
<version>5.11.3</version>
22+
<scope>test</scope>
23+
</dependency>
24+
25+
</dependencies>
26+
27+
28+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.luv2code.junitdemo;
2+
3+
import java.util.List;
4+
5+
public class DemoUtils {
6+
7+
private String academy = "Luv2Code Academy";
8+
private String academyDuplicate = academy;
9+
private String[] firstThreeLettersOfAlphabet = {"A", "B", "C"};
10+
private List<String> academyInList = List.of("luv", "2", "code");
11+
12+
public List<String> getAcademyInList() {
13+
return academyInList;
14+
}
15+
16+
public String getAcademy() {
17+
return academy;
18+
}
19+
20+
public String getAcademyDuplicate() {
21+
return academyDuplicate;
22+
}
23+
24+
public String[] getFirstThreeLettersOfAlphabet() {
25+
return firstThreeLettersOfAlphabet;
26+
}
27+
28+
public int add(int a, int b) {
29+
return a + b;
30+
}
31+
32+
public int multiply(int a, int b) {
33+
return a * b;
34+
}
35+
36+
public Object checkNull(Object obj) {
37+
38+
if (obj != null) {
39+
return obj;
40+
}
41+
return null;
42+
43+
}
44+
45+
public Boolean isGreater(int n1, int n2) {
46+
if (n1 > n2) {
47+
return true;
48+
}
49+
return false;
50+
}
51+
52+
public String throwException(int a) throws Exception {
53+
if (a < 0) {
54+
throw new Exception("Value should be greater than or equal to 0");
55+
}
56+
return "Value is greater than or equal to 0";
57+
}
58+
59+
public void checkTimeout() throws InterruptedException {
60+
System.out.println("I am going to sleep");
61+
Thread.sleep(2000);
62+
System.out.println("Sleeping over");
63+
}
64+
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.luv2code.junitdemo;
2+
3+
import org.junit.jupiter.api.*;
4+
5+
import static org.junit.jupiter.api.Assertions.*;
6+
7+
class DemoUtilsTest {
8+
9+
@Test
10+
void testEqualsAndNotEquals() {
11+
12+
DemoUtils demoUtils = new DemoUtils();
13+
14+
assertEquals(6, demoUtils.add(2, 4), "2+4 must be 6");
15+
assertNotEquals(6, demoUtils.add(1, 9), "1+9 must not be 6");
16+
}
17+
18+
@Test
19+
void testNullAndNotNull() {
20+
21+
DemoUtils demoUtils = new DemoUtils();
22+
23+
String str1 = null;
24+
String str2 = "luv2code";
25+
26+
assertNull(demoUtils.checkNull(str1), "Object should be null");
27+
assertNotNull(demoUtils.checkNull(str2), "Object should not be null");
28+
29+
}
30+
31+
}
32+
33+
34+
35+
36+
37+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.luv2code</groupId>
8+
<artifactId>junitdemo</artifactId>
9+
<version>1.0</version>
10+
11+
<properties>
12+
<maven.compiler.source>23</maven.compiler.source>
13+
<maven.compiler.target>23</maven.compiler.target>
14+
</properties>
15+
16+
<dependencies>
17+
18+
<dependency>
19+
<groupId>org.junit.jupiter</groupId>
20+
<artifactId>junit-jupiter</artifactId>
21+
<version>5.11.3</version>
22+
<scope>test</scope>
23+
</dependency>
24+
25+
</dependencies>
26+
27+
28+
</project>

0 commit comments

Comments
 (0)