📜  什么是 hamcrest - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:53.104000             🧑  作者: Mango

代码示例1
Hamcrest is a framework for writing matcher objects
allowing 'match' rules to be defined declaratively.


import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
public class BiscuitTest {
@Test
public void testEquals() {
Biscuit theBiscuit = new Biscuit("Ginger");
Biscuit myBiscuit = new Biscuit("Ginger");
assertThat(theBiscuit, equalTo(myBiscuit));