Skip to content
Advertisement

Tag: arrays

How to write a JUnit test case for ArrayStack methods

I am implementing an ArrayStack and we have to create a tester for it with JUnit and I wasn’t sure what to add to check if these two methods are working. The method addAll appends all values from the given list into the other list. Equals checks if two ArrayStacks are equal. I think I would have to create another

The program cannot do compareTo function after the object’s update information

I am trying to change the position of the product in the print menu after updating some information of the product. Specifically, arrange “Quantity” in descending order. If the products have same quantity, the list will be sorted with the ascending “UnitPrice” field. Initially, if i add one more product, compareTo() function works fine, but after i use product update

Advertisement