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 ef51394335e34..16c541441cc3e 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(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(subClusterIds))); + .createUniformWeights(new HashSet<>(subClusterIds))); manager.getWeightedPolicyInfo().setRouterPolicyWeights(GPGUtils - .createUniformWeights(new HashSet(subClusterIds))); + .createUniformWeights(new HashSet<>(subClusterIds))); SubClusterPolicyConfiguration testConf = manager.serializeConf(); when(stateStore.getPolicyConfiguration( GetSubClusterPolicyConfigurationRequest.newInstance("default"))) @@ -316,7 +316,7 @@ protected Map> getInfos( Map> ret = new HashMap<>(); for (SubClusterId id : activeSubClusters.keySet()) { if (!ret.containsKey(id)) { - ret.put(id, new HashMap()); + ret.put(id, new HashMap<>()); } ret.get(id).put(ClusterMetricsInfo.class, clusterInfos.get(id).get(ClusterMetricsInfo.class)); @@ -327,8 +327,7 @@ protected Map> getInfos( @Override protected Map getSchedulerInfo( Map activeSubClusters) { - Map ret = - new HashMap(); + Map ret = new HashMap<>(); for (SubClusterId id : activeSubClusters.keySet()) { ret.put(id, schedulerInfos.get(id)); }