mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
Merge commit 'b19a54d2f9d8a3e83366c638aace4cf3b5daa96e' as 'build/dobuild'
This commit is contained in:
57
build/dobuild/examples/gradle-junit5-example/Makefile
Normal file
57
build/dobuild/examples/gradle-junit5-example/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
SHELL := /bin/sh
|
||||
MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
.PHONY: default
|
||||
default: all
|
||||
|
||||
#######################################################################################################################
|
||||
# Overridable project defaults
|
||||
|
||||
DOBUILD_TOPDIR ?= $(DOBUILDDIR)
|
||||
DOBUILD_PROJECTDIR ?= $(patsubst %/,%,$(dir $(MAKEFILE)))
|
||||
DOBUILD_DOCKERFILE ?= $(PROJECTDIR)/%ID%.dockerfile
|
||||
|
||||
PROJECTDIR = $(DOBUILD_PROJECTDIR)
|
||||
DOBUILDDIR ?= $(PROJECTDIR)/../..
|
||||
|
||||
include $(DOBUILDDIR)/defaults.mk
|
||||
|
||||
#######################################################################################################################
|
||||
# Project defaults and macros
|
||||
|
||||
DEFAULTTARGET = x86_64-gradle@6.3-linux-java11+builder
|
||||
|
||||
#######################################################################################################################
|
||||
# Project dependencies
|
||||
|
||||
#######################################################################################################################
|
||||
# Architecture-specific rule target configuration
|
||||
|
||||
GRADLE_TARGETS += $(call target_properties_combine,\
|
||||
,\
|
||||
x86_64,\
|
||||
gradle,\
|
||||
linux,\
|
||||
java11,\
|
||||
builder,\
|
||||
6.3,\
|
||||
\
|
||||
)
|
||||
DOCKER_TARGETS += $(GRADLE_TARGETS)
|
||||
|
||||
#######################################################################################################################
|
||||
# Common rule target configuration
|
||||
|
||||
#######################################################################################################################
|
||||
# Makefile dependencies
|
||||
|
||||
#######################################################################################################################
|
||||
# Rules
|
||||
|
||||
include $(DOBUILDDIR)/gradle.mk
|
||||
include $(DOBUILDDIR)/docker.mk
|
||||
include $(DOBUILDDIR)/standardrules.mk
|
||||
|
||||
19
build/dobuild/examples/gradle-junit5-example/build.gradle
Normal file
19
build/dobuild/examples/gradle-junit5-example/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'eclipse'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
ARG REGISTRY_PREFIX=''
|
||||
ARG BUILDER_TAG=0.0.1
|
||||
|
||||
ARG HOSTMARCH
|
||||
ARG MARCH
|
||||
ARG DISTRIB_ID
|
||||
ARG DISTRIB_VERSION
|
||||
ARG SYS
|
||||
ARG ABI
|
||||
|
||||
FROM ${REGISTRY_PREFIX}${HOSTMARCH}/${MARCH}/graalvm-ce/20.0.0/${SYS}/${ABI}/${DISTRIB_ID}/${DISTRIB_VERSION}:${BUILDER_TAG}
|
||||
|
||||
ARG ID=
|
||||
ARG VARIANT=
|
||||
ARG PARALLELMFLAGS=
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.github.nosamad.dobuild.example;
|
||||
|
||||
public class Calculator {
|
||||
|
||||
public int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.github.nosamad.dobuild.example;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
|
||||
class CalculatorTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("1 + 1 = 2")
|
||||
void addsTwoNumbers() {
|
||||
Calculator calculator = new Calculator();
|
||||
assertEquals(2, calculator.add(1, 1), "1 + 1 should equal 2");
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "{0} + {1} = {2}")
|
||||
@CsvSource({
|
||||
"0, 1, 1",
|
||||
"1, 2, 3",
|
||||
"49, 51, 100",
|
||||
"1, 100, 101"
|
||||
})
|
||||
void add(int first, int second, int expectedResult) {
|
||||
Calculator calculator = new Calculator();
|
||||
assertEquals(expectedResult, calculator.add(first, second),
|
||||
() -> first + " + " + second + " should equal " + expectedResult);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user