Assert.assertEquals字符串引发的错误---org.junit.ComparisonFailure expected: but was:

当我运用test类的Assert.assertEquals比较字符串的时候出现如下错误:

Assert.assertEquals字符串引发的错误---org.junit.ComparisonFailure expected: but was:

调试出现如下:

Assert.assertEquals字符串引发的错误---org.junit.ComparisonFailure expected: but was:

因为从数据库里获得一般有时有\n或是\r\n,而我们直接给的值不带这些换行符号,所以会报上面的错误我们可以在指定地方加上\n例如:

Assert.assertEquals字符串引发的错误---org.junit.ComparisonFailure expected: but was: