Use 'Assert.assertEquals' to test method using Junit framework
Source: guru99.com JUnit assertEquals You have assertEquals(a,b) which relies on the equals() method of the Object class. Here it will be evaluated as a.equals( b ). Here the class under test is used to determine a suitable equality relation. If a class does not override the equals() method of Object class, it will get the default behaviour of equals() method, i.e. object identity. If a and b are primitives such as byte , int , boolean , etc. then the following will be done for assertEquals(a,b) : a and b will be converted to their equivalent wrapper object type ( Byte,Integer , Boolean , etc.), and then a.equals( b ) will be evaluated. For Example: Consider below-mentioned strings having same values, let's test it using assertTrue String obj1="Junit"; String obj2="Junit"; assertEquals(obj1,obj2); Above assert stateme...