@Test public void shouldReturnCommons() { when(platformCommons.getMotechVersion()).thenReturn(MOCK_MOTECH_VERSION); when(platformCommons.getNow()).thenReturn(MOCK_NOW); when(platformCommons.getToday()).thenReturn(MOCK_TODAY); PlatformCommons commons = (PlatformCommons) provider.lookup(PlatformCommons.class.getSimpleName(), "Platform commons", lookupFields); assertNotNull(commons); assertEquals(commons.getMotechVersion(), MOCK_MOTECH_VERSION); assertEquals(commons.getNow(), MOCK_NOW); assertEquals(commons.getToday(), MOCK_TODAY); }
@Override public Object lookup(String type, String lookupName, Map<String, String> lookupFields) { if(supports(type)) { return platformCommons; } return null; }
CommonsDataProvider extends AbstractDataProvider { @Override public Object lookup(String type, String lookupName, Map<String, String> lookupFields) { if(supports(type)) { return platformCommons; } return null; } }
CommonsDataProvider extends AbstractDataProvider { @Override public Object lookup(String type, String lookupName, Map<String, String> lookupFields) { if(supports(type)) { return platformCommons; } return null; } @Autowired  CommonsDataProvider(ResourceLoader resourceLoader); }
CommonsDataProvider extends AbstractDataProvider { @Override public Object lookup(String type, String lookupName, Map<String, String> lookupFields) { if(supports(type)) { return platformCommons; } return null; } @Autowired  CommonsDataProvider(ResourceLoader resourceLoader); @Autowired void setPlatformCommons(PlatformCommons platformCommons); @Override List<Class<?>> getSupportClasses(); @Override String getPackageRoot(); @Override String getName(); @Override Object lookup(String type, String lookupName, Map<String, String> lookupFields); }
CommonsDataProvider extends AbstractDataProvider { @Override public Object lookup(String type, String lookupName, Map<String, String> lookupFields) { if(supports(type)) { return platformCommons; } return null; } @Autowired  CommonsDataProvider(ResourceLoader resourceLoader); @Autowired void setPlatformCommons(PlatformCommons platformCommons); @Override List<Class<?>> getSupportClasses(); @Override String getPackageRoot(); @Override String getName(); @Override Object lookup(String type, String lookupName, Map<String, String> lookupFields);  }