@Test public void getInt_chainLogic() { toTest.providerChain.clear(); for (int i = 0; i < 3; i++) { toTest.providerChain.add(mock(ValueProvider.class)); if (i != 2) { doReturn(i).when(toTest.providerChain.get(i)).getPropertyValueAsInt(any(Property.class)); } else { doReturn(null).when(toTest.providerChain.get(i)).getPropertyValueAsInt(any(Property.class)); } } assertTrue(1 == toTest.getPropertyValueAsInt(Property.MAP_PROVIDER_SCHEMA)); }
public Integer getPropertyValueAsInt(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final Integer value = provider.getPropertyValueAsInt(property); if (value != null) { return value; } } return null; }
Config implements ValueProvider { public Integer getPropertyValueAsInt(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final Integer value = provider.getPropertyValueAsInt(property); if (value != null) { return value; } } return null; } }
Config implements ValueProvider { public Integer getPropertyValueAsInt(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final Integer value = provider.getPropertyValueAsInt(property); if (value != null) { return value; } } return null; } private  Config(); }
Config implements ValueProvider { public Integer getPropertyValueAsInt(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final Integer value = provider.getPropertyValueAsInt(property); if (value != null) { return value; } } return null; } private  Config(); static Config getInstance(); void setContext(final Context context); String getPropertyValue(final Property property); Integer getPropertyValueAsInt(final Property property); }
Config implements ValueProvider { public Integer getPropertyValueAsInt(final Property property) { for (int i = providerChain.size() - 1; i >= 0; i--) { final ValueProvider provider = providerChain.get(i); final Integer value = provider.getPropertyValueAsInt(property); if (value != null) { return value; } } return null; } private  Config(); static Config getInstance(); void setContext(final Context context); String getPropertyValue(final Property property); Integer getPropertyValueAsInt(final Property property);  }