Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
if: always()
with:
files: |
build/test-results/test/*.xml
jdk/build/test-results/test/*.xml
basics/build/test-results/test/*.xml

- name: Set badge color
shell: bash
Expand Down
33 changes: 4 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
# JavaLab

[![Java CI with Gradle](https://github.com/mperor/JavaLab/actions/workflows/gradle.yml/badge.svg)](https://github.com/mperor/JavaLab/actions/workflows/gradle.yml)
[![Test Results](https://gist.githubusercontent.com/mperor/710a27220e46b738c4a2ccb888676388/raw/badge.svg)](src/test/java/pl/mperor/lab/java)
[![Test Results](https://gist.githubusercontent.com/mperor/710a27220e46b738c4a2ccb888676388/raw/badge.svg)](jdk/src/test/java/pl/mperor/lab/java)

## Description
**JavaLab** serves as an experimental playground and knowledge base for the Java programming language.
The goal of this project is to maintain a set of tests that explore various nuances and intricacies of Java code.
Each test aims to provide clear examples and answers to common (and not-so-common) challenges developers face when working with Java.

### Key functionality tests in Java versions
## Modules

This project includes unit tests for key functionalities introduced in each Java version.

- [Java 1.1 (Java 1)](src/test/java/pl/mperor/lab/java/Java1.java)
- [Java 1.2 (Java 2)](src/test/java/pl/mperor/lab/java/Java2.java)
- [Java 1.3 (Java 3)](src/test/java/pl/mperor/lab/java/Java3.java)
- [Java 1.4 (Java 4)](src/test/java/pl/mperor/lab/java/Java4.java)
- [Java 1.5 (Java 5)](src/test/java/pl/mperor/lab/java/Java5.java)
- [Java 1.6 (Java 6)](src/test/java/pl/mperor/lab/java/Java6.java)
- [Java 1.7 (Java 7)](src/test/java/pl/mperor/lab/java/Java7.java)
- [Java 1.8 (Java 8)](src/test/java/pl/mperor/lab/java/Java8.java)
- [Java 9](src/test/java/pl/mperor/lab/java/Java9.java)
- [Java 10](src/test/java/pl/mperor/lab/java/Java10.java)
- [Java 11](src/test/java/pl/mperor/lab/java/Java11.java)
- [Java 12](src/test/java/pl/mperor/lab/java/Java12.java)
- [Java 13](src/test/java/pl/mperor/lab/java/Java13.java)
- [Java 14](src/test/java/pl/mperor/lab/java/Java14.java)
- [Java 15](src/test/java/pl/mperor/lab/java/Java15.java)
- [Java 16](src/test/java/pl/mperor/lab/java/Java16.java)
- [Java 17](src/test/java/pl/mperor/lab/java/Java17.java)
- [Java 18](src/test/java/pl/mperor/lab/java/Java18.java)
- [Java 19](src/test/java/pl/mperor/lab/java/Java19.java)
- [Java 20](src/test/java/pl/mperor/lab/java/Java20.java)
- [Java 21](src/test/java/pl/mperor/lab/java/Java21.java)
- [Java 22](src/test/java/pl/mperor/lab/java/Java22.java)
- [Java 23](src/test/java/pl/mperor/lab/java/Java23.java)

For detailed examples and tests of each feature, please refer to the individual source files linked above.
- **[JDK](jdk/README.md): JDK key features**
- **[BASICS](basics/README.md): Java basics**
5 changes: 5 additions & 0 deletions basics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Java Basics

## Description

**Java Basics** is a project that serves as a course for this language, attempting to describe it exclusively through examples of source code.
7 changes: 7 additions & 0 deletions basics/src/main/java/pl/mperor/lab/java/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package pl.mperor.lab.java;

public class Main {
public static void main(String[] args) {
System.out.println("Hello Java Basics module.");
}
}
21 changes: 21 additions & 0 deletions basics/src/test/java/pl/mperor/lab/java/JavaBasics.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package pl.mperor.lab.java;

import org.junit.jupiter.api.Test;

public class JavaBasics {

@Test
public void testTypesOfComments() {
// Single line comment
/*
Multi
line
comment
*/
/**
* JavaDoc
*/
/// Markdown JavaDoc (Since JDK 23)
}

}
46 changes: 21 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
plugins {
id 'java'
}

group = 'pl.mperor.lab.java'
version = '1.0-SNAPSHOT'

repositories {
mavenCentral()
}
subprojects {
apply plugin: 'java'

group = rootProject.group
version = rootProject.version

ext {
graaljsVersion = '24.1.1'
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.11.3')
testImplementation 'org.junit.jupiter:junit-jupiter'
}

dependencies {
testImplementation platform('org.junit:junit-bom:5.11.3')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'com.h2database:h2:2.2.224'
testRuntimeOnly "org.graalvm.js:js:${graaljsVersion}"
testImplementation "org.graalvm.js:js-scriptengine:${graaljsVersion}"
}
test {
useJUnitPlatform()
}

test {
useJUnitPlatform()
}
repositories {
mavenCentral()
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

tasks.withType(Test) {
jvmArgs("-Dfile.encoding=UTF-8")
tasks.withType(Test) {
jvmArgs("-Dfile.encoding=UTF-8")
}
}
31 changes: 31 additions & 0 deletions jdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# JDK key features

## Description

This project includes unit tests for key functionalities introduced in each Java version.

- [Java 1.1 (Java 1)](jdk/src/test/java/pl/mperor/lab/java/Java1.java)
- [Java 1.2 (Java 2)](jdk/src/test/java/pl/mperor/lab/java/Java2.java)
- [Java 1.3 (Java 3)](jdk/src/test/java/pl/mperor/lab/java/Java3.java)
- [Java 1.4 (Java 4)](jdk/src/test/java/pl/mperor/lab/java/Java4.java)
- [Java 1.5 (Java 5)](jdk/src/test/java/pl/mperor/lab/java/Java5.java)
- [Java 1.6 (Java 6)](jdk/src/test/java/pl/mperor/lab/java/Java6.java)
- [Java 1.7 (Java 7)](jdk/src/test/java/pl/mperor/lab/java/Java7.java)
- [Java 1.8 (Java 8)](jdk/src/test/java/pl/mperor/lab/java/Java8.java)
- [Java 9](jdk/src/test/java/pl/mperor/lab/java/Java9.java)
- [Java 10](jdk/src/test/java/pl/mperor/lab/java/Java10.java)
- [Java 11](jdk/src/test/java/pl/mperor/lab/java/Java11.java)
- [Java 12](jdk/src/test/java/pl/mperor/lab/java/Java12.java)
- [Java 13](jdk/src/test/java/pl/mperor/lab/java/Java13.java)
- [Java 14](jdk/src/test/java/pl/mperor/lab/java/Java14.java)
- [Java 15](jdk/src/test/java/pl/mperor/lab/java/Java15.java)
- [Java 16](jdk/src/test/java/pl/mperor/lab/java/Java16.java)
- [Java 17](jdk/src/test/java/pl/mperor/lab/java/Java17.java)
- [Java 18](jdk/src/test/java/pl/mperor/lab/java/Java18.java)
- [Java 19](jdk/src/test/java/pl/mperor/lab/java/Java19.java)
- [Java 20](jdk/src/test/java/pl/mperor/lab/java/Java20.java)
- [Java 21](jdk/src/test/java/pl/mperor/lab/java/Java21.java)
- [Java 22](jdk/src/test/java/pl/mperor/lab/java/Java22.java)
- [Java 23](jdk/src/test/java/pl/mperor/lab/java/Java23.java)

For detailed examples and tests of each feature, please refer to the individual source files linked above.
10 changes: 10 additions & 0 deletions jdk/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ext {
graaljsVersion = '24.1.1'
}

dependencies {
testRuntimeOnly 'com.h2database:h2:2.2.224'
testRuntimeOnly "org.graalvm.js:js:${graaljsVersion}"
testImplementation "org.graalvm.js:js-scriptengine:${graaljsVersion}"
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class Main {

public static void main(String[] args) {
System.out.println("Hello World!");
System.out.println("Hello JDK features module!");
SwingUtilities.invokeLater(SwingForm::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static void main(String[] args) {
int compilationResult = compiler.run(null, null, null, sourceFile.getAbsolutePath());
Assertions.assertEquals(0, compilationResult, "Compilation should succeed with result 0!");
Assertions.assertTrue(sourceFile.delete(), "Source file should be deleted after compilation");
Assertions.assertTrue(new File("./HelloWorld.class").delete(), "Now compilation result can be deleted!");
}

@Test
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'JavaLab'

include 'jdk', 'basics'