From da7c8344d1b6cb1b61a919df857de6aa0da6b87c Mon Sep 17 00:00:00 2001 From: "Jerry.Chen" Date: Tue, 21 Jul 2020 08:56:58 +0800 Subject: [PATCH] feature: change deprecated method code --- .../DisableMonitorMethodAfterCase1Tests.java | 15 ++++---------- .../DisableMonitorMethodAroundCase1Tests.java | 15 ++++---------- .../DisableMonitorMethodAroundCase2Tests.java | 15 ++++---------- .../DisableMonitorMethodBeforeCase1Tests.java | 15 ++++---------- ...DisableUnMonitorMethodAfterCase1Tests.java | 15 ++++---------- ...isableUnMonitorMethodAroundCase1Tests.java | 15 ++++---------- ...isableUnMonitorMethodAroundCase2Tests.java | 15 ++++---------- ...isableUnMonitorMethodBeforeCase1Tests.java | 15 ++++---------- .../method/MonitorMethodAfterCase1Tests.java | 3 --- .../method/MonitorMethodAfterCase2Tests.java | 3 --- .../method/MonitorMethodAfterCase3Tests.java | 3 --- .../method/MonitorMethodAroundCase1Tests.java | 3 --- .../method/MonitorMethodAroundCase2Tests.java | 3 --- .../method/MonitorMethodAroundCase3Tests.java | 3 --- .../method/MonitorMethodAroundCase4Tests.java | 3 --- .../method/MonitorMethodAroundCase5Tests.java | 3 --- .../method/MonitorMethodAroundCase6Tests.java | 3 --- .../method/MonitorMethodBeforeCase1Tests.java | 3 --- .../method/MonitorMethodBeforeCase2Tests.java | 3 --- .../method/MonitorMethodBeforeCase3Tests.java | 3 --- .../method/MonitorMethodBeforeCase4Tests.java | 3 --- .../UnMonitorMethodAfterCase1Tests.java | 3 --- .../UnMonitorMethodAfterCase2Tests.java | 3 --- .../UnMonitorMethodAfterCase3Tests.java | 3 --- .../UnMonitorMethodAroundCase1Tests.java | 3 --- .../UnMonitorMethodAroundCase2Tests.java | 3 --- .../UnMonitorMethodAroundCase3Tests.java | 3 --- .../UnMonitorMethodAroundCase4Tests.java | 3 --- .../UnMonitorMethodAroundCase5Tests.java | 3 --- .../UnMonitorMethodAroundCase6Tests.java | 3 --- .../UnMonitorMethodBeforeCase1Tests.java | 3 --- .../UnMonitorMethodBeforeCase2Tests.java | 3 --- .../UnMonitorMethodBeforeCase3Tests.java | 3 --- .../cloud/core/lang/dto/DirectionTests.java | 14 ++++--------- .../myoss/cloud/core/lang/dto/OrderTests.java | 14 ++++--------- .../myoss/cloud/core/lang/dto/PageTests.java | 2 +- .../myoss/cloud/core/lang/dto/SortTests.java | 20 ++++++------------- .../cloud/core/utils/IdCardUtilsTests.java | 14 +++---------- .../http/okhttp3/HttpLoggingInterceptor.java | 2 +- .../ControllerDefaultErrorAttributes.java | 3 ++- .../error/MonitorControllerProperties.java | 4 ++-- .../server/filter/LogWebRequestFilter.java | 2 +- ...gControllerExceptionHandlerCase1Tests.java | 10 +++------- 43 files changed, 59 insertions(+), 221 deletions(-) diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAfterCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAfterCase1Tests.java index e80922e..db61078 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAfterCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAfterCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -44,9 +43,6 @@ */ @RunWith(SpringRunner.class) public class DisableMonitorMethodAfterCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -59,20 +55,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase1Tests.java index 8f17f84..0850efe 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -44,9 +43,6 @@ */ @RunWith(SpringRunner.class) public class DisableMonitorMethodAroundCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -59,20 +55,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase2Tests.java index df07b9b..6202e64 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodAroundCase2Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -46,9 +45,6 @@ */ @RunWith(SpringRunner.class) public class DisableMonitorMethodAroundCase2Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -61,20 +57,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodBeforeCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodBeforeCase1Tests.java index 0d9f0f6..4eb0828 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodBeforeCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableMonitorMethodBeforeCase1Tests.java @@ -19,9 +19,8 @@ import java.io.Writer; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -46,9 +45,6 @@ */ @RunWith(SpringRunner.class) public class DisableMonitorMethodBeforeCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -62,20 +58,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAfterCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAfterCase1Tests.java index 02fed72..3b839fc 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAfterCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAfterCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -45,9 +44,6 @@ */ @RunWith(SpringRunner.class) public class DisableUnMonitorMethodAfterCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -60,20 +56,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase1Tests.java index 14e9508..b7112c1 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -45,9 +44,6 @@ */ @RunWith(SpringRunner.class) public class DisableUnMonitorMethodAroundCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -60,20 +56,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase2Tests.java index f4fb25d..cbf1475 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodAroundCase2Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -47,9 +46,6 @@ */ @RunWith(SpringRunner.class) public class DisableUnMonitorMethodAroundCase2Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -62,20 +58,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodBeforeCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodBeforeCase1Tests.java index 87e7ea8..e272b61 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodBeforeCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/DisableUnMonitorMethodBeforeCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.apm.log.method; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -45,9 +44,6 @@ */ @RunWith(SpringRunner.class) public class DisableUnMonitorMethodBeforeCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -60,20 +56,17 @@ public void isInjectComponent() { @Test public void didNotInjectMonitorMethodBefore() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodBefore.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodBefore.class)); } @Test public void didNotInjectMonitorMethodAfter() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAfter.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAfter.class)); } @Test public void didNotInjectMonitorMethodAround() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(MonitorMethodAround.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, () -> context.getBean(MonitorMethodAround.class)); } // 开启AspectJ diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase1Tests.java index ee7c7fe..840a2f0 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase1Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAfterCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase2Tests.java index 0eb8252..4e2c776 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase2Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAfterCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase3Tests.java index e254ec6..cdfdeed 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAfterCase3Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAfterCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase1Tests.java index 1bb9b1b..6842a54 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase1Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAroundCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase2Tests.java index 4a3297f..db46a24 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase2Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAroundCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase3Tests.java index 9cd8195..ff04f03 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase3Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodAroundCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase4Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase4Tests.java index a2c9b49..b0f9866 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase4Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase4Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -55,8 +54,6 @@ public class MonitorMethodAroundCase4Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase5Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase5Tests.java index e93cf7a..1fe042b 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase5Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase5Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -55,8 +54,6 @@ public class MonitorMethodAroundCase5Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase6Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase6Tests.java index f2bc4dc..d02fdc6 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase6Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodAroundCase6Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -55,8 +54,6 @@ public class MonitorMethodAroundCase6Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase1Tests.java index effb240..4daaea4 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase1Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodBeforeCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase2Tests.java index 344b363..841879b 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase2Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodBeforeCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase3Tests.java index 662e76b..11d1950 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase3Tests.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -52,8 +51,6 @@ public class MonitorMethodBeforeCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase4Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase4Tests.java index 29e51d0..c94f862 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase4Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/MonitorMethodBeforeCase4Tests.java @@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -56,8 +55,6 @@ public class MonitorMethodBeforeCase4Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase1Tests.java index 62729ec..bd76462 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase1Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -51,8 +50,6 @@ public class UnMonitorMethodAfterCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase2Tests.java index 9f74f79..4570678 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase2Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodAfterCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase3Tests.java index fb91ffe..57d90f0 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAfterCase3Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodAfterCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase1Tests.java index 83175b7..f7e23b2 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase1Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodAroundCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase2Tests.java index b850afc..8349be4 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase2Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodAroundCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase3Tests.java index c6533f3..8ffc0d7 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase3Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodAroundCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase4Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase4Tests.java index 0fc2bc5..26527f2 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase4Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase4Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -52,8 +51,6 @@ public class UnMonitorMethodAroundCase4Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase5Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase5Tests.java index 26f717a..987bf73 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase5Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase5Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -52,8 +51,6 @@ public class UnMonitorMethodAroundCase5Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase6Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase6Tests.java index 4979078..1d60674 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase6Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodAroundCase6Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -52,8 +51,6 @@ public class UnMonitorMethodAroundCase6Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase1Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase1Tests.java index 3452983..f7dda8e 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase1Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase1Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodBeforeCase1Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase2Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase2Tests.java index 72b4c0a..cb9122b 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase2Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase2Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodBeforeCase2Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase3Tests.java b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase3Tests.java index f9f4a13..44ea94e 100644 --- a/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase3Tests.java +++ b/myoss-starter-apm/src/test/java/app/myoss/cloud/apm/log/method/UnMonitorMethodBeforeCase3Tests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.system.OutputCaptureRule; @@ -49,8 +48,6 @@ public class UnMonitorMethodBeforeCase3Tests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); @Autowired private ApplicationContext context; diff --git a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/DirectionTests.java b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/DirectionTests.java index 92ba9eb..184b884 100644 --- a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/DirectionTests.java +++ b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/DirectionTests.java @@ -22,7 +22,6 @@ import org.junit.Assert; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.springframework.boot.test.system.OutputCaptureRule; /** @@ -33,9 +32,7 @@ */ public class DirectionTests { @Rule - public ExpectedException exception = ExpectedException.none(); - @Rule - public OutputCaptureRule output = new OutputCaptureRule(); + public OutputCaptureRule output = new OutputCaptureRule(); @Test public void checkValueTest() { @@ -61,20 +58,17 @@ public void fromStringTest2() { @Test public void fromStringIllegalArgumentExceptionTest1() { - exception.expect(IllegalArgumentException.class); - Direction.fromString(null); + Assert.assertThrows(IllegalArgumentException.class, () -> Direction.fromString(null)); } @Test public void fromStringIllegalArgumentExceptionTest2() { - exception.expect(IllegalArgumentException.class); - Direction.fromString(""); + Assert.assertThrows(IllegalArgumentException.class, () -> Direction.fromString("")); } @Test public void fromStringIllegalArgumentExceptionTest3() { - exception.expect(IllegalArgumentException.class); - Direction.fromString("error"); + Assert.assertThrows(IllegalArgumentException.class, () -> Direction.fromString("error")); } @Test diff --git a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/OrderTests.java b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/OrderTests.java index 5d34dd9..abda990 100644 --- a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/OrderTests.java +++ b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/OrderTests.java @@ -20,9 +20,8 @@ import static org.assertj.core.api.Assertions.assertThat; import org.assertj.core.api.Condition; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; /** * {@link Order} 测试类 @@ -31,8 +30,6 @@ * @since 2018年5月14日 上午11:13:57 */ public class OrderTests { - @Rule - public ExpectedException exception = ExpectedException.none(); @Test public void checkValueTest() { @@ -61,19 +58,16 @@ public boolean matches(Order value) { @Test public void nullPropertyTest1() { - exception.expect(IllegalArgumentException.class); - new Order(Direction.ASC, null); + Assert.assertThrows(IllegalArgumentException.class, () -> new Order(Direction.ASC, null)); } @Test public void whitespacePropertyTest1() { - exception.expect(IllegalArgumentException.class); - new Order(Direction.ASC, ""); + Assert.assertThrows(IllegalArgumentException.class, () -> new Order(Direction.ASC, "")); } @Test public void whitespacePropertyTest2() { - exception.expect(IllegalArgumentException.class); - new Order(Direction.ASC, " "); + Assert.assertThrows(IllegalArgumentException.class, () -> new Order(Direction.ASC, " ")); } } diff --git a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/PageTests.java b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/PageTests.java index 9048e82..29b20a5 100644 --- a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/PageTests.java +++ b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/PageTests.java @@ -17,7 +17,7 @@ package app.myoss.cloud.core.lang.dto; -import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Map; diff --git a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/SortTests.java b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/SortTests.java index 2a3ef80..c754928 100644 --- a/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/SortTests.java +++ b/myoss-starter-core/src/test/java/app/myoss/cloud/core/lang/dto/SortTests.java @@ -25,7 +25,6 @@ import org.junit.Assert; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.springframework.boot.test.system.OutputCaptureRule; import com.google.common.collect.Lists; @@ -42,9 +41,7 @@ */ public class SortTests { @Rule - public ExpectedException exception = ExpectedException.none(); - @Rule - public OutputCaptureRule output = new OutputCaptureRule(); + public OutputCaptureRule output = new OutputCaptureRule(); @Test public void checkValueTest1() { @@ -119,34 +116,29 @@ public void nullOrderValueTest2() { @Test public void emptyOrderIllegalArgumentExceptionTest1() { List orders = Lists.newArrayList(); - exception.expect(IllegalArgumentException.class); - new Sort(orders); + Assert.assertThrows(IllegalArgumentException.class, () -> new Sort(orders)); } @Test public void emptyOrderIllegalArgumentExceptionTest2() { List orders = null; - exception.expect(IllegalArgumentException.class); - new Sort(orders); + Assert.assertThrows(IllegalArgumentException.class, () -> new Sort(orders)); } @Test public void nullPropertyIllegalArgumentExceptionTest1() { - exception.expect(IllegalArgumentException.class); - new Sort("id", null); + Assert.assertThrows(IllegalArgumentException.class, () -> new Sort("id", null)); } @Test public void nullPropertyIllegalArgumentExceptionTest2() { - exception.expect(IllegalArgumentException.class); - new Sort(Direction.DESC, "id", null); + Assert.assertThrows(IllegalArgumentException.class, () -> new Sort(Direction.DESC, "id", null)); } @Test public void nullPropertyIllegalArgumentExceptionTest3() { - exception.expect(IllegalArgumentException.class); List properties = Lists.newArrayList("id", null); - new Sort(Direction.ASC, properties); + Assert.assertThrows(IllegalArgumentException.class, () -> new Sort(Direction.ASC, properties)); } @Test diff --git a/myoss-starter-core/src/test/java/app/myoss/cloud/core/utils/IdCardUtilsTests.java b/myoss-starter-core/src/test/java/app/myoss/cloud/core/utils/IdCardUtilsTests.java index 8091115..b0908c6 100644 --- a/myoss-starter-core/src/test/java/app/myoss/cloud/core/utils/IdCardUtilsTests.java +++ b/myoss-starter-core/src/test/java/app/myoss/cloud/core/utils/IdCardUtilsTests.java @@ -30,9 +30,7 @@ import org.apache.commons.lang3.time.DateUtils; import org.junit.Assert; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import app.myoss.cloud.core.exception.BizRuntimeException; @@ -43,9 +41,6 @@ * @since 2018年6月1日 上午2:32:26 */ public class IdCardUtilsTests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { @@ -191,21 +186,18 @@ public void summertimeTest2() { @Test public void ciyCodeTest1() { Map cityCode = IdCardUtils.getCityCode(); - thrown.expect(UnsupportedOperationException.class); - cityCode.put("key", "value"); + Assert.assertThrows((UnsupportedOperationException.class), () -> cityCode.put("key", "value")); } @Test public void twFirstCodeTest1() { Map twFirstCode = IdCardUtils.getTwFirstCode(); - thrown.expect(UnsupportedOperationException.class); - twFirstCode.put("key", 1); + Assert.assertThrows(UnsupportedOperationException.class, () -> twFirstCode.put("key", 1)); } @Test public void hkFirstCodeTest1() { Map hkFirstCode = IdCardUtils.getHkFirstCode(); - thrown.expect(UnsupportedOperationException.class); - hkFirstCode.put("key", 1); + Assert.assertThrows(UnsupportedOperationException.class, () -> hkFirstCode.put("key", 1)); } } diff --git a/myoss-starter-web/src/main/java/app/myoss/cloud/web/http/okhttp3/HttpLoggingInterceptor.java b/myoss-starter-web/src/main/java/app/myoss/cloud/web/http/okhttp3/HttpLoggingInterceptor.java index fa07c50..77e7db8 100644 --- a/myoss-starter-web/src/main/java/app/myoss/cloud/web/http/okhttp3/HttpLoggingInterceptor.java +++ b/myoss-starter-web/src/main/java/app/myoss/cloud/web/http/okhttp3/HttpLoggingInterceptor.java @@ -266,7 +266,7 @@ public Response intercept(Chain chain) throws IOException { BufferedSource source = responseBody.source(); // Buffer the entire body. source.request(Long.MAX_VALUE); - Buffer buffer = source.buffer(); + Buffer buffer = source.getBuffer(); Long gzippedLength = null; if ("gzip".equalsIgnoreCase(headers.get("Content-Encoding"))) { diff --git a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/ControllerDefaultErrorAttributes.java b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/ControllerDefaultErrorAttributes.java index a976311..c249762 100644 --- a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/ControllerDefaultErrorAttributes.java +++ b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/ControllerDefaultErrorAttributes.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.ErrorAttributes; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.http.HttpMethod; @@ -58,7 +59,7 @@ public class ControllerDefaultErrorAttributes implements ErrorAttributes { protected MonitorControllerProperties properties; @Override - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Throwable error = getError(request); HttpStatus errorStatus = determineHttpStatus(error); URI requestUrl = request.uri(); diff --git a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/MonitorControllerProperties.java b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/MonitorControllerProperties.java index cb24722..0860263 100644 --- a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/MonitorControllerProperties.java +++ b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/method/error/MonitorControllerProperties.java @@ -36,14 +36,14 @@ public class MonitorControllerProperties { * Controller异常时返回的errorCode * * @see ControllerDefaultErrorAttributes#getErrorAttributes(ServerRequest, - * boolean) + * org.springframework.boot.web.error.ErrorAttributeOptions) */ private String controllerExceptionErrorCode = "systemException"; /** * Controller异常时返回的errorCode * * @see ControllerDefaultErrorAttributes#getErrorAttributes(ServerRequest, - * boolean) + * org.springframework.boot.web.error.ErrorAttributeOptions) */ private String controllerExceptionErrorMsg = "We'll be back soon ..."; } diff --git a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/server/filter/LogWebRequestFilter.java b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/server/filter/LogWebRequestFilter.java index 37d5a03..bbb1aaa 100644 --- a/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/server/filter/LogWebRequestFilter.java +++ b/myoss-starter-webflux/src/main/java/app/myoss/cloud/web/reactive/spring/web/server/filter/LogWebRequestFilter.java @@ -196,7 +196,7 @@ public Mono filter(ServerWebExchange exchange, WebFilterChain filterChain) Date date = new Date(); // 调用下一个 filter - return filterChain.filter(exchange).compose((call) -> filter(exchange, call, startNs, date)); + return filterChain.filter(exchange).transformDeferred((call) -> filter(exchange, call, startNs, date)); } private Mono filter(ServerWebExchange exchange, Mono call, long startNs, Date date) { diff --git a/myoss-starter-webmvc/src/test/java/app/myoss/cloud/web/spring/web/method/aspectj/DisableAopLogControllerExceptionHandlerCase1Tests.java b/myoss-starter-webmvc/src/test/java/app/myoss/cloud/web/spring/web/method/aspectj/DisableAopLogControllerExceptionHandlerCase1Tests.java index 5e8ad45..edc47e9 100644 --- a/myoss-starter-webmvc/src/test/java/app/myoss/cloud/web/spring/web/method/aspectj/DisableAopLogControllerExceptionHandlerCase1Tests.java +++ b/myoss-starter-webmvc/src/test/java/app/myoss/cloud/web/spring/web/method/aspectj/DisableAopLogControllerExceptionHandlerCase1Tests.java @@ -17,9 +17,8 @@ package app.myoss.cloud.web.spring.web.method.aspectj; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -46,9 +45,6 @@ @RunWith(SpringRunner.class) @WebAppConfiguration public class DisableAopLogControllerExceptionHandlerCase1Tests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Autowired private ApplicationContext context; @@ -59,8 +55,8 @@ public void isInjectComponent() { @Test public void didNotInjectControllerAdvice() { - thrown.expect(NoSuchBeanDefinitionException.class); - context.getBean(AopLogControllerExceptionHandler.class); + Assert.assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(AopLogControllerExceptionHandler.class)); } @Slf4j