Monday, July 29, 2019

Question: How do you check whether a table data(values) is sorted or not? Sorting happens when clicking on Table Header(Ex: Name, which is a link).
Name
Venu
Avinash
Dharma
Answer:
We can take an array of String type as expected values and consider the column values which need to be verify are as actual values. Which can be resolved by below example.


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CompareTwoLists {
       public static void main(String[] ar){
              List<String> expdValues = new ArrayList<String>();
              expdValues.add("venu");
              expdValues.add("avinash");
              expdValues.add("dharma");
              Collections.sort(expdValues);     //to arrange given list in sorting
             
              List<String> actValues = new ArrayList<String>();
              actValues.add("dharma");
              actValues.add("venu");
              expdValues.add("avinash");
              Collections.sort(actValues);
             
              if(expdValues.equals(actValues)){
                     System.out.println("Given Lists are Matched");
              }else{
                     System.out.println("Given lists are not matched");
              }
       }
}



Related Posts:

  • STLC (Software Testing Life Cycle) Software Testing Life Cycle: Below is the summary of STLC along with Entry and Exit Criteria: Following phases are involved in STLC: Requirement Analysis Test Planning Test case development Test Environment setup Test Execu… Read More
  • Introduction to Software Testing Software Testing:  The process of verifying or validating an application with the intention of finding bugs or defect in software so that it could be corrected before product is delivered to the end user.   … Read More
  • Arraylist vs HashMap Difference between Arraylist and HashMap? ArrayList implements List Interface while HashMap is an implementation of Map interface. Memory consumption is high in HashMap compared to the ArrayList. ArrayList maintains the ins… Read More
  • BufferedReader vs Scanner Difference between BufferedReader and Scanner: It can parse the user input and read an int, short, byte, float, long and double apart from String. On the other hand, BufferedReader can only read String in Java. BuffredReade… Read More
  • Software Development Life Cycle (SDLC) SDLC:  A Framework containing the Processes, Activities, and the Tasks involved in the development, operation and maintenance of a software project (spanning the life of the system) from the definition of its requir… Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts