YARN-9263. TestConfigurationNodeAttributesProvider fails after Mockito updated. Contributed by Weiwei Yang.

This commit is contained in:
Weiwei Yang 2019-02-02 23:04:34 +08:00
parent 28ad20a711
commit f20b043a02
1 changed files with 3 additions and 4 deletions

View File

@ -93,7 +93,7 @@ public class TestConfigurationNodeAttributesProvider {
YarnConfiguration.NM_NODE_ATTRIBUTES_PROVIDER_FETCH_INTERVAL_MS, 1000);
ConfigurationNodeAttributesProvider spyProvider =
Mockito.spy(nodeAttributesProvider);
Mockito.when(spyProvider.parseAttributes(Mockito.anyString()))
Mockito.when(spyProvider.parseAttributes(Mockito.any()))
.thenReturn(expectedAttributes1);
spyProvider.init(conf);
@ -107,7 +107,7 @@ public class TestConfigurationNodeAttributesProvider {
expectedAttributes2.add(NodeAttribute
.newInstance("test.io", "os",
NodeAttributeType.STRING, "windows"));
Mockito.when(spyProvider.parseAttributes(Mockito.anyString()))
Mockito.when(spyProvider.parseAttributes(Mockito.any()))
.thenReturn(expectedAttributes2);
// Since we set fetch interval to 1s, it needs to wait for 1s until
@ -152,11 +152,10 @@ public class TestConfigurationNodeAttributesProvider {
YarnConfiguration.NM_NODE_ATTRIBUTES_PROVIDER_FETCH_INTERVAL_MS, -1);
ConfigurationNodeAttributesProvider spyProvider =
Mockito.spy(nodeAttributesProvider);
Mockito.when(spyProvider.parseAttributes(Mockito.anyString()))
Mockito.when(spyProvider.parseAttributes(Mockito.any()))
.thenReturn(expectedAttributes1);
spyProvider.init(conf);
spyProvider.start();
Assert.assertEquals(expectedAttributes1,
spyProvider.getDescriptors());