Java tutorial
package ch.cyberduck.core.importer; /* * Copyright (c) 2002-2013 David Kocher. All rights reserved. * http://cyberduck.ch/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Bug fixes, suggestions and comments should be sent to feedback@cyberduck.ch */ import ch.cyberduck.core.Host; import ch.cyberduck.core.Local; import ch.cyberduck.core.ProtocolFactory; import ch.cyberduck.core.Scheme; import ch.cyberduck.core.TestProtocol; import ch.cyberduck.core.exception.AccessDeniedException; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; public class WinScpBookmarkCollectionTest { @Test(expected = AccessDeniedException.class) public void testParseNotFound() throws Exception { new WinScpBookmarkCollection().parse(new ProtocolFactory(Collections.emptySet()), new Local(System.getProperty("java.io.tmpdir"), "f")); } @Test public void testParse() throws Exception { WinScpBookmarkCollection c = new WinScpBookmarkCollection(); assertEquals(0, c.size()); c.parse(new ProtocolFactory( new HashSet<>(Arrays.asList(new TestProtocol(Scheme.ftp), new TestProtocol(Scheme.sftp)))), new Local("src/test/resources/WinSCP.ini")); assertEquals(127, c.size()); for (Host bookmark : c) { assertFalse(StringUtils.isBlank(bookmark.getHostname())); } } }