-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from mkotsur/DEPLOYITPB-4656
Fixed SshSudoFile.equals
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/com/xebialabs/overthere/ssh/SshSudoFileTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.xebialabs.overthere.ssh; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.not; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class SshSudoFileTest { | ||
|
||
public static final String REMOTE_PATH = "/tmp/file.txt"; | ||
private SshSudoConnection connection; | ||
|
||
@BeforeClass | ||
public void setup() { | ||
connection = mock(SshSudoConnection.class); | ||
} | ||
|
||
@Test | ||
public void shouldNotBeEqualWhenOneIsTempAndAnotherIsNot() { | ||
SshSudoFile f1 = new SshSudoFile(connection, REMOTE_PATH, false); | ||
SshSudoFile f2 = new SshSudoFile(connection, REMOTE_PATH, true); | ||
assertThat(f1, is(not(f2))); | ||
assertThat(f1.hashCode(), is(not(f2.hashCode()))); | ||
} | ||
|
||
@Test | ||
public void shouldBeEqual() { | ||
SshSudoFile f1 = new SshSudoFile(connection, REMOTE_PATH, false); | ||
SshSudoFile f2 = new SshSudoFile(connection, REMOTE_PATH, false); | ||
assertThat(f1, is(f2)); | ||
assertThat(f1.hashCode(), is(f2.hashCode())); | ||
} | ||
|
||
} |