Skip to content
Snippets Groups Projects
Verified Commit 0d6a8434 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Create

parents
No related merge requests found
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Maven build / target directory
target/
# IntelliJ IDEA files
.idea/
*.iml
*.iws
# Eclipse files
.classpath
.project
.settings/
# NetBeans files
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
# VS Code directories
.vscode/
# Ignore MacOSX filesystem artifacts
.DS_Store
# Ignore Windows filesystem artifacts
Thumbs.db
# Ignore Linux filesystem artifacts
.*swp
# An example Java 11 project using Maven and JUnit 5.x
1. Get adoptopenjdk-11: https://adoptopenjdk.net/
2. Get maven 3.6.x: https://maven.apache.org/
3. Add above to your path if neccessary.
4. `git clone git@github.com:example/test.git`
5. `mvn clean package`
6. `java -jar target/efrei-lab07-generics-empty-0.0.1-SNAPSHOT.jar`
pom.xml 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<name>efrei-lab07-generics-empty</name>
<artifactId>efrei-lab07-generics-empty</artifactId>
<groupId>vsb-cs-java1</groupId>
<version>0.0.1-SNAPSHOT</version>
<description>An example Java 11 project using Maven and JUnit 5.x</description>
<url>https://github.com/example/test</url>
<licenses>
<license>
<name>MIT</name>
<url>https://spdx.org/licenses/MIT.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.class>lab.HelloWorld</main.class>
<java.version>17</java.version>
<junit.jupiter.version>5.4.2</junit.jupiter.version>
<maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
<maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
<maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
<maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
<maven.minimal.required.version>3.2.5</maven.minimal.required.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.plugin.version}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven.enforcer.plugin.version}</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>
[${maven.minimal.required.version},)</version>
<message>Project requires minimum Maven
version
${maven.minimal.required.version}</message>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package lab;
import java.util.logging.Logger;
public class HelloWorld {
public static void main(String... args) {
Logger logger=Logger.getLogger(HelloWorld.class.getName());
logger.info("This is a module-using Hello World!"); }
}
module lab {
requires java.logging;
}
package lab;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import java.util.List;
public class HelloWorldTest {
@Test
public void testImmutableCollections() {
List<String> fruits = List.of("Mangosteen", "Durian fruit", "Longan");
assertThrows(UnsupportedOperationException.class, () -> {
fruits.add("Mango");
fruits.remove(1);
});
assertEquals(3, fruits.size());
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment