Skip to content

Tag: unit-testing

How do I compare Integer and Long types with Junit?

How do I compare Integer and Long types with Junit ? The result of assertThat(poiList.get(0).get(“id_pk”)).isEqualTo(member.getId_pk()); is: The two types are: How can I compare 1 and 1L to be equal? best regards Answer You can convert Integer to Long via java.lang.Integer#longValue: BUT beware of…