mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
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 com.intellij.vcs.log.Hash;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author erokhins
|
* @author erokhins
|
||||||
@@ -27,27 +27,26 @@ public class HashEqualsTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testEqualsSelf() {
|
public void testEqualsSelf() {
|
||||||
Hash hash = HashImpl.build("adf");
|
Hash hash = HashImpl.build("adf");
|
||||||
//noinspection EqualsWithItself
|
assertThat(hash).isEqualTo(hash);
|
||||||
assertTrue(hash.equals(hash));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsNull() {
|
public void testEqualsNull() {
|
||||||
Hash hash = HashImpl.build("adf");
|
Hash hash = HashImpl.build("adf");
|
||||||
assertFalse(hash.equals(null));
|
assertThat(hash).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
Hash hash1 = HashImpl.build("adf");
|
Hash hash1 = HashImpl.build("adf");
|
||||||
Hash hash2 = HashImpl.build("adf");
|
Hash hash2 = HashImpl.build("adf");
|
||||||
assertTrue(hash1.equals(hash2));
|
assertThat(hash1).isEqualTo(hash2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsNone() {
|
public void testEqualsNone() {
|
||||||
Hash hash1 = HashImpl.build("");
|
Hash hash1 = HashImpl.build("");
|
||||||
Hash hash2 = HashImpl.build("");
|
Hash hash2 = HashImpl.build("");
|
||||||
assertTrue(hash1.equals(hash2));
|
assertThat(hash1).isEqualTo(hash2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user