ListProvidersScanner implements ArtifactInstaller { @Override public boolean canHandle(File artifact) { return LIST_PROVIDERS_DIRECTORY.equals(artifact.getParentFile().getName()) && artifact.getName().endsWith(".properties"); }  void setListProvidersService(ListProvidersService listProvidersService); @Override boolean canHandle(File artifact); @Override void install(File artifact); @Override void update(File artifact); @Override void uninstall(File artifact); static final String LIST_PROVIDERS_DIRECTORY; static final String LIST_NAME_KEY; static final String LIST_TRANSLATABLE_KEY; static final String LIST_ORG_KEY; static final String LIST_DEFAULT_KEY; }
@Test public void testCanHandle() { File wrongDirectory = new File("wrong"); File correctDirectory = new File(ListProvidersScanner.LIST_PROVIDERS_DIRECTORY); File wrongFilenameWrongDirectory = new File(wrongDirectory, "wrong.xml"); File wrongFilenameRightDirectory = new File(correctDirectory, "wrong.xml"); File rightFilenameWrongDirectory = new File(wrongDirectory, "right.properties"); File rightFilenameRightDirectory = new File(correctDirectory, "right.properties"); ListProvidersScanner listProvidersScanner = new ListProvidersScanner(); assertFalse(listProvidersScanner.canHandle(wrongFilenameWrongDirectory)); assertFalse(listProvidersScanner.canHandle(wrongFilenameRightDirectory)); assertFalse(listProvidersScanner.canHandle(rightFilenameWrongDirectory)); assertTrue(listProvidersScanner.canHandle(rightFilenameRightDirectory)); }