From 1509f0a1ee032d1ab1dbe89a7884f3f11b283d5b Mon Sep 17 00:00:00 2001 From: ahunigel Date: Tue, 17 Mar 2020 22:03:38 +0800 Subject: [PATCH] move testing features to `com.github.ahunigel:spring-test-toolkit:1.0` --- README.md | 6 +++-- .../test/EnvironmentProfileValueSource.java | 18 --------------- ...ystemEnvAndPropertyProfileValueSource.java | 18 --------------- .../ahunigel/test/RunTestOnWindowsOnly.java | 22 ------------------- 4 files changed, 4 insertions(+), 60 deletions(-) delete mode 100644 src/main/java/com/github/ahunigel/test/EnvironmentProfileValueSource.java delete mode 100644 src/main/java/com/github/ahunigel/test/MergedSystemEnvAndPropertyProfileValueSource.java delete mode 100644 src/main/java/com/github/ahunigel/test/RunTestOnWindowsOnly.java diff --git a/README.md b/README.md index 68974e8..d608db6 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,10 @@ Provide an additional toolkit library for spring framework. - reverse converter with `.reverse()` method - functional converter, used for java `stream` mapping - instance of spring converter -- JUnit 4 `@IfProfileValue` profile source enhancement +- ~~JUnit 4 `@IfProfileValue` profile source enhancement~~ Moved to https://jitpack.io/#ahunigel/spring-test-toolkit - `@ProfileValueSourceConfiguration(EnvironmentProfileValueSource.class)`, use environment as profile value source - `@ProfileValueSourceConfiguration(MergedSystemEnvAndPropertyProfileValueSource.class)`, use environment and system properties as profile value source -- JUnit 4 `@RunTestOnWindowsOnly` annotation, restrict JUnit 4 tests running only on windows operation system +- ~~JUnit 4 `@RunTestOnWindowsOnly` annotation, restrict JUnit 4 tests running only on windows operation system~~ Moved to https://jitpack.io/#ahunigel/spring-test-toolkit ## How to use @@ -44,6 +44,7 @@ public class FooApplication {} class FooConverter extends ReversibleConverter {} ``` +~~All the following testing features are moved to https://jitpack.io/#ahunigel/spring-test-toolkit~~ ```java @ProfileValueSourceConfiguration(EnvironmentProfileValueSource.class) public class FooTest { @@ -64,6 +65,7 @@ public class FooTest {} - [Using YAML Instead of Properties](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-yaml) - [Spring @PropertySource using YAML](https://stackoverflow.com/questions/21271468/spring-propertysource-using-yaml) - [Spring YAML Configuration](https://www.baeldung.com/spring-yaml) +- [spring-test-toolkit](https://jitpack.io/#ahunigel/spring-test-toolkit) ## TODOs diff --git a/src/main/java/com/github/ahunigel/test/EnvironmentProfileValueSource.java b/src/main/java/com/github/ahunigel/test/EnvironmentProfileValueSource.java deleted file mode 100644 index 07ce911..0000000 --- a/src/main/java/com/github/ahunigel/test/EnvironmentProfileValueSource.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.ahunigel.test; - -import org.springframework.test.annotation.ProfileValueSource; - -/** - * Use environment as profile value source - *

- * Created by Nigel.Zheng on 2019/5/14. - * - * @author Nigel.Zheng - */ -public class EnvironmentProfileValueSource implements ProfileValueSource { - - @Override - public String get(String key) { - return System.getenv(key); - } -} diff --git a/src/main/java/com/github/ahunigel/test/MergedSystemEnvAndPropertyProfileValueSource.java b/src/main/java/com/github/ahunigel/test/MergedSystemEnvAndPropertyProfileValueSource.java deleted file mode 100644 index 97ca252..0000000 --- a/src/main/java/com/github/ahunigel/test/MergedSystemEnvAndPropertyProfileValueSource.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.ahunigel.test; - -import org.springframework.test.annotation.ProfileValueSource; - -/** - * Merge environment and system properties as profile value source - *

- * Created by Nigel.Zheng on 2019/5/14. - * - * @author Nigel.Zheng - */ -public class MergedSystemEnvAndPropertyProfileValueSource implements ProfileValueSource { - - @Override - public String get(String key) { - return System.getenv(key) != null ? System.getenv(key) : System.getProperty(key); - } -} diff --git a/src/main/java/com/github/ahunigel/test/RunTestOnWindowsOnly.java b/src/main/java/com/github/ahunigel/test/RunTestOnWindowsOnly.java deleted file mode 100644 index f25f07c..0000000 --- a/src/main/java/com/github/ahunigel/test/RunTestOnWindowsOnly.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.github.ahunigel.test; - -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; - -import java.lang.annotation.*; - -/** - * Run JUnit 4 tests only on windows operation system - *

- * Created by Nigel.Zheng on 2019/5/20. - * - * @author Nigel.Zheng - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -@ProfileValueSourceConfiguration(EnvironmentProfileValueSource.class) -@IfProfileValue(name = "OS", values = {"Windows_NT"}) -public @interface RunTestOnWindowsOnly { -}