Test Hash comparisons using assertThat

which makes failure messages and assertion code more readable,
and avoids http://errorprone.info/bugpattern/SelfEquals.
This commit is contained in:
Dana Dahlstrom
2016-12-06 20:42:48 +03:00
committed by Kirill Likhodedov
parent 12ecd5fb35
commit 154e3efd04
@@ -18,7 +18,7 @@ package com.intellij.vcs.log.impl;
import com.intellij.vcs.log.Hash;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author erokhins
@@ -27,27 +27,26 @@ public class HashEqualsTest {
@Test
public void testEqualsSelf() {
Hash hash = HashImpl.build("adf");
//noinspection EqualsWithItself
assertTrue(hash.equals(hash));
assertThat(hash).isEqualTo(hash);
}
@Test
public void testEqualsNull() {
Hash hash = HashImpl.build("adf");
assertFalse(hash.equals(null));
assertThat(hash).isNotNull();
}
@Test
public void testEquals() {
Hash hash1 = HashImpl.build("adf");
Hash hash2 = HashImpl.build("adf");
assertTrue(hash1.equals(hash2));
assertThat(hash1).isEqualTo(hash2);
}
@Test
public void testEqualsNone() {
Hash hash1 = HashImpl.build("");
Hash hash2 = HashImpl.build("");
assertTrue(hash1.equals(hash2));
assertThat(hash1).isEqualTo(hash2);
}
}