title: How to write a Junit test case for arraylist (retrieving data by location)??. Please prefer the below code
body: <p>This is the complete code . And I need to write a Test case. Please help me out writing the Test Case, i am a beginner and very new to Junit. </p>
  
  <pre><code>public class Register1 {
  
      String name;
      String location;
      int id;
      int salary;
  
      public Register1(String name, String location, int id, int salary) {
          this.name = name;
          this.location = location;
          this.id = id;
          this.salary = salary;
  
      }
  
  }
  
  
  import java.util.*;
  
  public class Employee {
  
      public static void main(String[] args) {
          ArrayList&lt;Register1&gt; Emp = new ArrayList&lt;Register1&gt;();
          Emp.add(new Register1("Jack", "London", 101, 800));
          Emp.add(new Register1("Mike", "UK", 100, 60000));
          Emp.add(new Register1("Andrew", "China", 103, 2000));
          Emp.add(new Register1("Michel", "Korea", 106, 300000));
          Emp.add(new Register1("Donald", "London", 102, 90000));
  
          List&lt;Register1&gt; reg = new ArrayList&lt;Register1&gt;();
          String input = "London";
          for (Register1 adrs : Emp) {
              if (adrs.location.equals(input)) {
                  reg.add(adrs);
  
              }
          }
  
          for (Register1 adrs : reg) {
              System.out.println("Employee from London:" + adrs.salary + " "
                      + adrs.location + " " + adrs.id + " " + adrs.name);
          }
      }
  }
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <p>Employee from London:800 London 101 Jack</p>
  
  <p>Employee from London:90000 London 102 Donald</p>