AssertJ 可以验证一个值是特定数据类型吗?

Can AssertJ verify that a value is of a specific data type?

我已经在网上进行了搜索,但一直在努力寻找一种方法让 AssertJ 验证数据类型,例如,我想验证 JSON 响应中的值是否为长数据类型一个双:

像这样:

JsonPath jp = response.jsonPath();
long money= jp.get("amount.money");
Assertions.assertThat(money).isNotDouble; //isNotDouble is not a valid method, but I want to achieve something similar to this. isLong also does not exist.

有没有办法为 money 创建正则表达式或模式并将其用作验证点?

有这样的方法。

Assertions.assertThat(table).isInstanceOf(Long.class);
Assertions.assertThat(table).isInstanceOfAny(Long.class, Number.class);
Assertions.assertThat(table).isExactlyInstanceOf(Long.class);
Assertions.assertThat(table).isInstanceOfSatisfying(Long.class, num -> {
        
});

还有isNot变体