From 6ba01c9aaaf4dffe1fe4ac95196e5a10078aa76d Mon Sep 17 00:00:00 2001
From: slfan1989 <slfan1989@apache.org>
Date: Wed, 5 Jul 2023 16:22:30 +0800
Subject: [PATCH] YARN-7707. Fix CheckStyle.

---
 .../policygenerator/TestPolicyGenerator.java        | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/test/java/org/apache/hadoop/yarn/server/globalpolicygenerator/policygenerator/TestPolicyGenerator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/test/java/org/apache/hadoop/yarn/server/globalpolicygenerator/policygenerator/TestPolicyGenerator.java
index ef51394335e34b..16c541441cc3e4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/test/java/org/apache/hadoop/yarn/server/globalpolicygenerator/policygenerator/TestPolicyGenerator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/test/java/org/apache/hadoop/yarn/server/globalpolicygenerator/policygenerator/TestPolicyGenerator.java
@@ -146,9 +146,9 @@ public void setUp() throws IOException, YarnException, JAXBException {
     schedulerInfos.put(subClusterIds.get(0), sti2);
 
     stateStore = mock(FederationStateStore.class);
-    when(stateStore.getSubClusters((GetSubClustersInfoRequest) any()))
+    when(stateStore.getSubClusters(any()))
         .thenReturn(GetSubClustersInfoResponse.newInstance(
-            new ArrayList<SubClusterInfo>(subClusterInfos.values())));
+        new ArrayList<>(subClusterInfos.values())));
     facade.reinitialize(stateStore, conf);
   }
 
@@ -220,9 +220,9 @@ public void testExistingPolicy() throws YarnException {
     // Add a test policy for test queue
     manager.setQueue("default");
     manager.getWeightedPolicyInfo().setAMRMPolicyWeights(GPGUtils
-        .createUniformWeights(new HashSet<SubClusterId>(subClusterIds)));
+        .createUniformWeights(new HashSet<>(subClusterIds)));
     manager.getWeightedPolicyInfo().setRouterPolicyWeights(GPGUtils
-        .createUniformWeights(new HashSet<SubClusterId>(subClusterIds)));
+        .createUniformWeights(new HashSet<>(subClusterIds)));
     SubClusterPolicyConfiguration testConf = manager.serializeConf();
     when(stateStore.getPolicyConfiguration(
         GetSubClusterPolicyConfigurationRequest.newInstance("default")))
@@ -316,7 +316,7 @@ protected Map<SubClusterId, Map<Class, Object>> getInfos(
       Map<SubClusterId, Map<Class, Object>> ret = new HashMap<>();
       for (SubClusterId id : activeSubClusters.keySet()) {
         if (!ret.containsKey(id)) {
-          ret.put(id, new HashMap<Class, Object>());
+          ret.put(id, new HashMap<>());
         }
         ret.get(id).put(ClusterMetricsInfo.class,
             clusterInfos.get(id).get(ClusterMetricsInfo.class));
@@ -327,8 +327,7 @@ protected Map<SubClusterId, Map<Class, Object>> getInfos(
     @Override
     protected Map<SubClusterId, SchedulerInfo> getSchedulerInfo(
         Map<SubClusterId, SubClusterInfo> activeSubClusters) {
-      Map<SubClusterId, SchedulerInfo> ret =
-          new HashMap<SubClusterId, SchedulerInfo>();
+      Map<SubClusterId, SchedulerInfo> ret = new HashMap<>();
       for (SubClusterId id : activeSubClusters.keySet()) {
         ret.put(id, schedulerInfos.get(id));
       }