You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description:
Referring to the API document of ''org.junit.Test'' , the correct API of ''AssertEquals'' is ''assertEquals(Object expected, Object actual)''.
However, we detect that some assertions in your test code have the wrong parameter orders.
For example, the test case named ''testAddressFunctions()'' in ''TestAddress.java'' writes the assertion into ''Assert.assertEquals( address.getOriginal(), a);'', ''Assert.assertEquals( address.getUrl().getHost(), "www.httprecipes.com");'', ''Assert.assertEquals( address2.getOriginal(), a);'', and ''Assert.assertEquals( address3.getOriginal(), a);''.
Negative:
Once the test case fails, the ''assertEquals()'' assertion with the wrong parameter order will give the wrong log information.
The log information will say: "expected [false] but found [true]", where it should have said "expected [true] but found [false]". This is confusing, to say the least, and you shouldn't have to deal with a possible misdirection of that message.
Solution:
Generally, the excepted value should be a known value, such as a real number, a string, etc.
The actual value should be the result -f the-method-under-test.
Therefore, the ''Assert.assertEquals( address.getOriginal(), a);'' should be changed into ''Assert.assertEquals(a, address.getOriginal());'';
the ''Assert.assertEquals( address.getUrl().getHost(), "www.httprecipes.com");'' should be changed into ''Assert.assertEquals("www.httprecipes.com", address.getUrl().getHost());''; ....
We list the test cases with the same problem as follows:
''testAddressFunctions()'' in TestAddress.java
''testClone()'' in TestBiPolarNeuralData.java
''testAStar()'' in TestSearch.java
''testBredthFirstSearch()'' in TestSearch.java
''testDepthFirstSearch()'' in TestSearch.java
''check2D()'' in TestNormArray.java
''check1D()'' in TestNormArray.java
''check()'' in TestMapped.java ...
The text was updated successfully, but these errors were encountered:
Hi!
description:
Referring to the API document of ''org.junit.Test'' , the correct API of ''AssertEquals'' is ''assertEquals(Object expected, Object actual)''.
However, we detect that some assertions in your test code have the wrong parameter orders.
For example, the test case named ''testAddressFunctions()'' in ''TestAddress.java'' writes the assertion into ''Assert.assertEquals( address.getOriginal(), a);'', ''Assert.assertEquals( address.getUrl().getHost(), "www.httprecipes.com");'', ''Assert.assertEquals( address2.getOriginal(), a);'', and ''Assert.assertEquals( address3.getOriginal(), a);''.
Negative:
Once the test case fails, the ''assertEquals()'' assertion with the wrong parameter order will give the wrong log information.
The log information will say: "expected [false] but found [true]", where it should have said "expected [true] but found [false]". This is confusing, to say the least, and you shouldn't have to deal with a possible misdirection of that message.
Solution:
Generally, the excepted value should be a known value, such as a real number, a string, etc.
The actual value should be the result -f the-method-under-test.
Therefore, the ''Assert.assertEquals( address.getOriginal(), a);'' should be changed into ''Assert.assertEquals(a, address.getOriginal());'';
the ''Assert.assertEquals( address.getUrl().getHost(), "www.httprecipes.com");'' should be changed into ''Assert.assertEquals("www.httprecipes.com", address.getUrl().getHost());''; ....
We list the test cases with the same problem as follows:
''testAddressFunctions()'' in TestAddress.java
''testClone()'' in TestBiPolarNeuralData.java
''testAStar()'' in TestSearch.java
''testBredthFirstSearch()'' in TestSearch.java
''testDepthFirstSearch()'' in TestSearch.java
''check2D()'' in TestNormArray.java
''check1D()'' in TestNormArray.java
''check()'' in TestMapped.java ...
The text was updated successfully, but these errors were encountered: