Skip to content

Commit 475df90

Browse files
committed
[#noissue] Cleanup
1 parent 61fa3d3 commit 475df90

File tree

44 files changed

+332
-469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+332
-469
lines changed

batch/src/test/java/com/navercorp/pinpoint/batch/alarm/collector/FileDescriptorDataCollectorTest.java

+11-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.assertj.core.api.Assertions;
2525
import org.junit.jupiter.api.Test;
2626

27-
import java.util.ArrayList;
2827
import java.util.List;
2928
import java.util.Map;
3029

@@ -47,28 +46,31 @@ public void collect() {
4746
long timeStamp = 1558936971494L;
4847
Range range = Range.newUncheckedRange(timeStamp - DataCollectorFactory.SLOT_INTERVAL_FIVE_MIN, timeStamp);
4948

50-
List<FileDescriptorBo> fileDescriptorBoList1 = new ArrayList<>();
5149
FileDescriptorBo fileDescriptorBo1_1 = new FileDescriptorBo();
5250
fileDescriptorBo1_1.setOpenFileDescriptorCount(200);
5351
FileDescriptorBo fileDescriptorBo1_2 = new FileDescriptorBo();
5452
fileDescriptorBo1_2.setOpenFileDescriptorCount(300);
5553
FileDescriptorBo fileDescriptorBo1_3 = new FileDescriptorBo();
5654
fileDescriptorBo1_3.setOpenFileDescriptorCount(400);
57-
fileDescriptorBoList1.add(fileDescriptorBo1_1);
58-
fileDescriptorBoList1.add(fileDescriptorBo1_2);
59-
fileDescriptorBoList1.add(fileDescriptorBo1_3);
55+
56+
List<FileDescriptorBo> fileDescriptorBoList1 = List.of(
57+
fileDescriptorBo1_1,
58+
fileDescriptorBo1_2,
59+
fileDescriptorBo1_3
60+
);
6061
when(fileDescriptorDao.getAgentStatList(agentId1, range)).thenReturn(fileDescriptorBoList1);
6162

62-
List<FileDescriptorBo> fileDescriptorBoList2 = new ArrayList<>();
6363
FileDescriptorBo fileDescriptorBo2_1 = new FileDescriptorBo();
6464
fileDescriptorBo2_1.setOpenFileDescriptorCount(250);
6565
FileDescriptorBo fileDescriptorBo2_2 = new FileDescriptorBo();
6666
fileDescriptorBo2_2.setOpenFileDescriptorCount(350);
6767
FileDescriptorBo fileDescriptorBo2_3 = new FileDescriptorBo();
6868
fileDescriptorBo2_3.setOpenFileDescriptorCount(450);
69-
fileDescriptorBoList2.add(fileDescriptorBo2_1);
70-
fileDescriptorBoList2.add(fileDescriptorBo2_2);
71-
fileDescriptorBoList2.add(fileDescriptorBo2_3);
69+
List<FileDescriptorBo> fileDescriptorBoList2 = List.of(
70+
fileDescriptorBo2_1,
71+
fileDescriptorBo2_2,
72+
fileDescriptorBo2_3
73+
);
7274
when(fileDescriptorDao.getAgentStatList(agentId2, range)).thenReturn(fileDescriptorBoList2);
7375

7476
FileDescriptorDataCollector fileDescriptorDataCollector = new FileDescriptorDataCollector(

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/DefaultClassBasedMatcherTest.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import static org.assertj.core.api.Assertions.assertThat;
2626
import static org.junit.jupiter.api.Assertions.assertEquals;
27-
import static org.junit.jupiter.api.Assertions.assertTrue;
2827

2928
/**
3029
* @author jaehong.kim
@@ -37,7 +36,7 @@ public void getMatcherOperandWithClassName() {
3736
assertEquals("java.lang.String", matcher.getBaseClassName());
3837

3938
MatcherOperand operand = matcher.getMatcherOperand();
40-
assertTrue(operand instanceof ClassInternalNameMatcherOperand);
39+
assertThat(operand).isInstanceOf(ClassInternalNameMatcherOperand.class);
4140
ClassInternalNameMatcherOperand classInternalNameMatcherOperand = (ClassInternalNameMatcherOperand) operand;
4241
assertEquals("java/lang/String", classInternalNameMatcherOperand.getClassInternalName());
4342
}
@@ -49,7 +48,7 @@ public void getMatcherOperandWithClassNameAndAdditional() {
4948
assertEquals("java.lang.String", matcher.getBaseClassName());
5049

5150
MatcherOperand operand = matcher.getMatcherOperand();
52-
assertTrue(operand instanceof AndMatcherOperator);
51+
assertThat(operand).isInstanceOf(AndMatcherOperator.class);
5352

5453
AndMatcherOperator operator = (AndMatcherOperator) operand;
5554
assertThat(operator.getLeftOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/DefaultMultiClassBasedMatcherTest.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
2828
import static org.junit.jupiter.api.Assertions.assertEquals;
29-
import static org.junit.jupiter.api.Assertions.assertTrue;
3029

3130
/**
3231
* @author jaehong.kim
@@ -41,13 +40,13 @@ public void getMatcherOperandWithMultiClassName() {
4140
.contains("java.lang.String", "java.lang.Thread");
4241

4342
MatcherOperand operand = matcher.getMatcherOperand();
44-
assertTrue(operand instanceof OrMatcherOperator);
43+
assertThat(operand).isInstanceOf(OrMatcherOperator.class);
4544
OrMatcherOperator operator = (OrMatcherOperator) operand;
46-
assertTrue(operator.getLeftOperand() instanceof ClassInternalNameMatcherOperand);
45+
assertThat(operator.getLeftOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
4746
ClassInternalNameMatcherOperand leftOperand = (ClassInternalNameMatcherOperand) operator.getLeftOperand();
4847
assertEquals("java/lang/String", leftOperand.getClassInternalName());
4948

50-
assertTrue(operator.getRightOperand() instanceof ClassInternalNameMatcherOperand);
49+
assertThat(operator.getRightOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
5150
ClassInternalNameMatcherOperand rightOperand = (ClassInternalNameMatcherOperand) operator.getRightOperand();
5251
assertEquals("java/lang/Thread", rightOperand.getClassInternalName());
5352
}
@@ -61,12 +60,12 @@ public void getMatcherOperandWithMultiClassNameAndAdditional() {
6160
.contains("java.lang.String", "java.lang.Thread");
6261

6362
MatcherOperand operand = matcher.getMatcherOperand();
64-
assertTrue(operand instanceof AndMatcherOperator);
63+
assertThat(operand).isInstanceOf(AndMatcherOperator.class);
6564
AndMatcherOperator operator = (AndMatcherOperator) operand;
6665
// (class OR class)
67-
assertTrue(operator.getLeftOperand() instanceof OrMatcherOperator);
66+
assertThat(operator.getLeftOperand()).isInstanceOf(OrMatcherOperator.class);
6867
// ... AND interface
69-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
68+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
7069
InterfaceInternalNameMatcherOperand rightOperand = (InterfaceInternalNameMatcherOperand) operator.getRightOperand();
7170
assertEquals("java/lang/Runnable", rightOperand.getInterfaceInternalName());
7271
}

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/DefaultMultiPackageBasedMatcherTest.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import static org.assertj.core.api.Assertions.assertThat;
2626
import static org.junit.jupiter.api.Assertions.assertEquals;
27-
import static org.junit.jupiter.api.Assertions.assertTrue;
2827

2928
/**
3029
* @author jaehong.kim
@@ -38,13 +37,13 @@ public void getMatcherOperandWithMulitPackageName() {
3837
.contains("java", "javax");
3938

4039
MatcherOperand operand = matcher.getMatcherOperand();
41-
assertTrue(operand instanceof OrMatcherOperator);
40+
assertThat(operand).isInstanceOf(OrMatcherOperator.class);
4241
OrMatcherOperator operator = (OrMatcherOperator) operand;
43-
assertTrue(operator.getLeftOperand() instanceof PackageInternalNameMatcherOperand);
42+
assertThat(operator.getLeftOperand()).isInstanceOf(PackageInternalNameMatcherOperand.class);
4443
PackageInternalNameMatcherOperand leftOperand = (PackageInternalNameMatcherOperand) operator.getLeftOperand();
4544
assertEquals("java", leftOperand.getPackageInternalName());
4645

47-
assertTrue(operator.getRightOperand() instanceof PackageInternalNameMatcherOperand);
46+
assertThat(operator.getRightOperand()).isInstanceOf(PackageInternalNameMatcherOperand.class);
4847
PackageInternalNameMatcherOperand rightOperand = (PackageInternalNameMatcherOperand) operator.getRightOperand();
4948
assertEquals("javax", rightOperand.getPackageInternalName());
5049
}

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/DefaultPackageBasedMatcherTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import org.junit.jupiter.api.Assertions;
2323
import org.junit.jupiter.api.Test;
2424

25+
import static org.assertj.core.api.Assertions.assertThat;
2526
import static org.junit.jupiter.api.Assertions.assertEquals;
26-
import static org.junit.jupiter.api.Assertions.assertTrue;
2727

2828
/**
2929
* @author jaehong.kim
@@ -36,7 +36,7 @@ public void getMatcherOperandWithPackageName() {
3636
assertEquals("java.lang", packageBasedMatcher.getBasePackageName());
3737

3838
MatcherOperand operand = packageBasedMatcher.getMatcherOperand();
39-
assertTrue(operand instanceof PackageInternalNameMatcherOperand);
39+
assertThat(operand).isInstanceOf(PackageInternalNameMatcherOperand.class);
4040
PackageInternalNameMatcherOperand packageInternalNameMatcherOperand = (PackageInternalNameMatcherOperand) operand;
4141
assertEquals("java/lang", packageInternalNameMatcherOperand.getPackageInternalName());
4242
}
@@ -48,19 +48,19 @@ public void getMatcherOperandWithPackageNameAndAdditional() {
4848
assertEquals("java.lang", packageBasedMatcher.getBasePackageName());
4949

5050
MatcherOperand operand = packageBasedMatcher.getMatcherOperand();
51-
assertTrue(operand instanceof AndMatcherOperator);
51+
assertThat(operand).isInstanceOf(AndMatcherOperator.class);
5252

5353
AndMatcherOperator operator = (AndMatcherOperator) operand;
54-
assertTrue(operator.getLeftOperand() instanceof PackageInternalNameMatcherOperand);
55-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
54+
assertThat(operator.getLeftOperand()).isInstanceOf(PackageInternalNameMatcherOperand.class);
55+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
5656
}
5757

5858
@Test
5959
public void getMatcherOperandWithPackageNameAndAdditionalIsNull() {
6060
// check unusual pattern.
6161
PackageBasedMatcher classMatcher = new DefaultPackageBasedMatcher("java.lang", null);
6262
MatcherOperand operand = classMatcher.getMatcherOperand();
63-
assertTrue(operand instanceof PackageInternalNameMatcherOperand);
63+
assertThat(operand).isInstanceOf(PackageInternalNameMatcherOperand.class);
6464
PackageInternalNameMatcherOperand annotationInternalNameMatcherOperand = (PackageInternalNameMatcherOperand) operand;
6565
assertEquals("java/lang", annotationInternalNameMatcherOperand.getPackageInternalName());
6666
}

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/LambdaExpressionMatcherTest.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import org.junit.jupiter.api.Assertions;
88
import org.junit.jupiter.api.Test;
99

10-
import static org.junit.jupiter.api.Assertions.*;
10+
import static org.assertj.core.api.Assertions.assertThat;
11+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
1113

1214
public class LambdaExpressionMatcherTest {
1315

@@ -17,25 +19,25 @@ public void getMatcherOperand() {
1719
assertEquals("java.lang.Runnable" + LambdaExpressionMatcher.LAMBDA_INSTANCE_NAME_PREFIX, matcher.getBasePackageName());
1820

1921
MatcherOperand operand = matcher.getMatcherOperand();
20-
assertTrue(operand instanceof AndMatcherOperator);
22+
assertThat(operand).isInstanceOf(AndMatcherOperator.class);
2123

2224
AndMatcherOperator operator = (AndMatcherOperator) operand;
23-
assertTrue(operator.getLeftOperand() instanceof PackageInternalNameMatcherOperand);
24-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
25+
assertThat(operator.getLeftOperand()).isInstanceOf(PackageInternalNameMatcherOperand.class);
26+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
2527
}
2628

2729
@Test
2830
public void getMatcherOperandWithBaseClassNameIsNull() {
29-
Assertions.assertThrows(NullPointerException.class, () -> {
31+
assertThatThrownBy(() -> {
3032
LambdaExpressionMatcher lambdaExpressionMatcher = new LambdaExpressionMatcher(null, "java.util.function.Function");
31-
});
33+
}).isInstanceOf(NullPointerException.class);
3234
}
3335

3436
@Test
3537
public void getMatcherOperandWithBaseClassNameIsEmpty() {
36-
Assertions.assertThrows(IllegalArgumentException.class, () -> {
38+
assertThatThrownBy(() -> {
3739
LambdaExpressionMatcher lambdaExpressionMatcher = new LambdaExpressionMatcher("", "java.util.function.Function");
38-
});
40+
}).isInstanceOf(IllegalArgumentException.class);
3941
}
4042

4143
@Test

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/operand/AbstractMatcherOperandTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.OrMatcherOperator;
2121
import org.junit.jupiter.api.Test;
2222

23-
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
import static org.assertj.core.api.Assertions.assertThat;
2424

2525
/**
2626
* @author jaehong.kim
@@ -33,14 +33,14 @@ public void and() {
3333
operand = operand.and(new InterfaceInternalNameMatcherOperand("java/lang/Runnable", false));
3434
operand = operand.and(new AnnotationInternalNameMatcherOperand("javax/annotation/Resource", false));
3535

36-
assertTrue(operand instanceof AndMatcherOperator);
36+
assertThat(operand).isInstanceOf(AndMatcherOperator.class);
3737
AndMatcherOperator operator = (AndMatcherOperator) operand;
38-
assertTrue(operator.getLeftOperand() instanceof AndMatcherOperator);
39-
assertTrue(operator.getRightOperand() instanceof AnnotationInternalNameMatcherOperand);
38+
assertThat(operator.getLeftOperand()).isInstanceOf(AndMatcherOperator.class);
39+
assertThat(operator.getRightOperand()).isInstanceOf(AnnotationInternalNameMatcherOperand.class);
4040

4141
operator = (AndMatcherOperator) operator.getLeftOperand();
42-
assertTrue(operator.getLeftOperand() instanceof ClassInternalNameMatcherOperand);
43-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
42+
assertThat(operator.getLeftOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
43+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
4444
}
4545

4646
@Test
@@ -49,23 +49,23 @@ public void or() {
4949
operand = operand.or(new InterfaceInternalNameMatcherOperand("java/lang/Runnable", false));
5050
operand = operand.or(new AnnotationInternalNameMatcherOperand("javax/annotation/Resource", false));
5151

52-
assertTrue(operand instanceof OrMatcherOperator);
52+
assertThat(operand).isInstanceOf(OrMatcherOperator.class);
5353
OrMatcherOperator operator = (OrMatcherOperator) operand;
54-
assertTrue(operator.getLeftOperand() instanceof OrMatcherOperator);
55-
assertTrue(operator.getRightOperand() instanceof AnnotationInternalNameMatcherOperand);
54+
assertThat(operator.getLeftOperand()).isInstanceOf(OrMatcherOperator.class);
55+
assertThat(operator.getRightOperand()).isInstanceOf(AnnotationInternalNameMatcherOperand.class);
5656

5757
operator = (OrMatcherOperator) operator.getLeftOperand();
58-
assertTrue(operator.getLeftOperand() instanceof ClassInternalNameMatcherOperand);
59-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
58+
assertThat(operator.getLeftOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
59+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
6060
}
6161

6262
@Test
6363
public void not() {
6464
MatcherOperand operand = new ClassInternalNameMatcherOperand("java/lang/String");
6565
operand = operand.not();
6666

67-
assertTrue(operand instanceof NotMatcherOperator);
67+
assertThat(operand).isInstanceOf(NotMatcherOperator.class);
6868
NotMatcherOperator operator = (NotMatcherOperator) operand;
69-
assertTrue(operator.getRightOperand() instanceof ClassInternalNameMatcherOperand);
69+
assertThat(operator.getRightOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
7070
}
7171
}

bootstraps/bootstrap-core/src/test/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/operator/AndMatcherOperatorTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand;
2020
import org.junit.jupiter.api.Test;
2121

22+
import static org.assertj.core.api.Assertions.assertThat;
2223
import static org.junit.jupiter.api.Assertions.assertEquals;
2324
import static org.junit.jupiter.api.Assertions.assertFalse;
2425
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -34,8 +35,8 @@ public void base() throws Exception {
3435
assertEquals(2, operator.getPrecedence());
3536
assertTrue(operator.isOperator());
3637
assertFalse(operator.isIndex());
37-
assertTrue(operator.getLeftOperand() instanceof ClassInternalNameMatcherOperand);
38-
assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
38+
assertThat(operator.getLeftOperand()).isInstanceOf(ClassInternalNameMatcherOperand.class);
39+
assertThat(operator.getRightOperand()).isInstanceOf(InterfaceInternalNameMatcherOperand.class);
3940
assertEquals(3, operator.getExecutionCost());
4041
}
4142
}

bootstraps/bootstrap-java9/src/test/java/com/navercorp/pinpoint/bootstrap/java9/classloader/Java9ClassLoaderTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import java.io.IOException;
2929
import java.net.URL;
3030

31+
import static org.assertj.core.api.Assertions.assertThat;
32+
3133
/**
3234
* @author Woonduk Kang(emeroad)
3335
*/
@@ -77,7 +79,7 @@ private ClassLoader onLoadTest(Class<?> classLoaderType, Class<?> testClass) thr
7779
public void loadClass_bootstrap() throws Exception {
7880

7981
ClassLoader cl = PinpointClassLoaderFactory.createClassLoader(this.getClass().getName(), new URL[]{}, null, ProfilerLibs.PINPOINT_PROFILER_CLASS);
80-
Assertions.assertTrue(cl instanceof Java9ClassLoader);
82+
assertThat(cl).isInstanceOf(Java9ClassLoader.class);
8183

8284
Class<?> stringClazz1 = cl.loadClass("java.lang.String");
8385
Class<?> stringClazz2 = ClassLoader.getSystemClassLoader().loadClass("java.lang.String");

collector/src/main/java/com/navercorp/pinpoint/collector/receiver/thrift/UDPReceiverBean.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.navercorp.pinpoint.collector.util.ObjectPool;
3030
import com.navercorp.pinpoint.collector.util.ObjectPoolFactory;
3131
import com.navercorp.pinpoint.common.server.util.AddressFilter;
32-
3332
import org.apache.thrift.TBase;
3433
import org.springframework.beans.factory.BeanNameAware;
3534
import org.springframework.beans.factory.DisposableBean;
@@ -38,7 +37,7 @@
3837
import java.net.DatagramPacket;
3938
import java.net.InetSocketAddress;
4039
import java.net.SocketAddress;
41-
import java.util.Collections;
40+
import java.util.List;
4241
import java.util.Objects;
4342
import java.util.concurrent.Executor;
4443

@@ -99,7 +98,7 @@ private UDPReceiver createUdpReceiver(String name, String bindIp, int port, int
9998

10099
private TBaseFilter<SocketAddress> newTBaseFilter() {
101100
TBaseFilter<SocketAddress> filter = new NetworkAvailabilityCheckPacketFilter<>();
102-
return new TBaseFilterChain<>(Collections.singletonList(filter));
101+
return new TBaseFilterChain<>(List.of(filter));
103102
}
104103

105104
@Override

collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapperTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public void mapTest() {
5353
}
5454

5555
private AgentStatBo createCpuLoadBoList() {
56-
AgentStatBo.Builder builder = AgentStatBo.newBuilder(TEST_AGENT, startTimestamp);
5756

57+
AgentStatBo.Builder builder = AgentStatBo.newBuilder(TEST_AGENT, startTimestamp);
5858
CpuLoadBo cpuLoadBo1 = new CpuLoadBo();
5959
cpuLoadBo1.setJvmCpuLoad(4);
6060
cpuLoadBo1.setSystemCpuLoad(3);

0 commit comments

Comments
 (0)