ZMSFileChangeLogStoreCommon { public List<String> getLocalDomainList() { List<String> names = new ArrayList<>(); String[] domains = rootDir.list(); if (domains == null) { return names; } for (String name : domains) { if (name.charAt(0) != '.') { names.add(name); } } return names; } ZMSFileChangeLogStoreCommon(final String rootDirectory); boolean supportsFullRefresh(); SignedDomain getLocalSignedDomain(final String domainName); SignedDomain getServerSignedDomain(ZMSClient zmsClient, final String domainName); void removeLocalDomain(String domainName); void saveLocalDomain(String domainName, SignedDomain signedDomain); synchronized T get(String name, Class<T> classType); synchronized void put(String name, byte[] data); synchronized void delete(String name); List<String> getLocalDomainList(); Set<String> getServerDomainList(ZMSClient zmsClient); SignedDomains getServerDomainModifiedList(ZMSClient zmsClient); String retrieveLastModificationTime(); void setLastModificationTimestamp(String newLastModTime); String retrieveTagHeader(Map<String, List<String>> responseHeaders); SignedDomains getUpdatedSignedDomains(ZMSClient zmsClient, StringBuilder lastModTimeBuffer); public String lastModTime; }
@Test public void testGetLocalDomainListError() { ZMSFileChangeLogStoreCommon cstore = new ZMSFileChangeLogStoreCommon(FSTORE_PATH); File dir = Mockito.spy(cstore.rootDir); Mockito.when(dir.list()).thenReturn(null); cstore.rootDir = dir; List<String> ls = cstore.getLocalDomainList(); assertTrue(ls.isEmpty()); }