View Javadoc
1   /*
2    * Copyright (C) 2015, Kaloyan Raev <kaloyan.r@zend.com> and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.api;
11  
12  import static org.junit.Assert.assertTrue;
13  
14  import org.eclipse.jgit.transport.RemoteConfig;
15  import org.junit.Test;
16  
17  public class RemoteDeleteCommandTest extends AbstractRemoteCommandTest {
18  
19  	@Test
20  	public void testDelete() throws Exception {
21  		// setup an initial remote
22  		RemoteConfig remoteConfig = setupRemote();
23  
24  		// execute the command to remove the remote
25  		RemoteRemoveCommand cmd = Git.wrap(db).remoteRemove();
26  		cmd.setRemoteName(REMOTE_NAME);
27  		RemoteConfig remote = cmd.call();
28  
29  		// assert that the removed remote is the initial remote
30  		assertRemoteConfigEquals(remoteConfig, remote);
31  		// assert that there are no remotes left
32  		assertTrue(RemoteConfig.getAllRemoteConfigs(db.getConfig()).isEmpty());
33  	}
34  
35  }