Skip to content

Commit

Permalink
feature: change deprecated method code
Browse files Browse the repository at this point in the history
  • Loading branch information
myoss committed Jul 21, 2020
1 parent 135ee7a commit da7c834
Show file tree
Hide file tree
Showing 43 changed files with 59 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,9 +43,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableMonitorMethodAfterCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,9 +43,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableMonitorMethodAroundCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,9 +45,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableMonitorMethodAroundCase2Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,9 +45,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableMonitorMethodBeforeCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,9 +44,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableUnMonitorMethodAfterCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,9 +44,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableUnMonitorMethodAroundCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,9 +46,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableUnMonitorMethodAroundCase2Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,9 +44,6 @@
*/
@RunWith(SpringRunner.class)
public class DisableUnMonitorMethodBeforeCase1Tests {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,8 +51,6 @@
public class MonitorMethodAfterCase1Tests {
@Rule
public OutputCaptureRule output = new OutputCaptureRule();
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,8 +51,6 @@
public class MonitorMethodAfterCase2Tests {
@Rule
public OutputCaptureRule output = new OutputCaptureRule();
@Rule
public ExpectedException thrown = ExpectedException.none();

@Autowired
private ApplicationContext context;
Expand Down
Loading

0 comments on commit da7c834

Please sign in to comment.