title: Method not returning the desired result
body: <p>I have included a block of code below that I just cannot seem to figure out what I am doing wrong. The code is part of a program that I am writing that populates an array list with virtual gas station objects containing several explicit parameters; one of which is a "description" that is a String parameter being the name of the gas station. The method in question, findStation(), takes an explicit parameter that is set to the name of a gas station. Then, using this I search through my array list looking for a gas station description(using a previously declared getDescription() method that I know functions correctly) that matches my toMatch explicit parameter. If a match is found, the integer position in which it is found is returned. </p>
  
  <p>Well, I feel as if I have properly written the code, but when I attempt to do a Junit test on it, I get the error "Expected &lt;6>, but returned &lt;-1>". Does anyone see anything immediately wrong with either my method syntax or the way I am testing the method? Thanks in advance for all the help from you wonderful people!</p>
  
  <p>By the way, I have tried to include everything that pertains to figuring out the specific method in question. Let me know if something else is needed!</p>
  
  <p><strong>Method in question: I create a temporary Station object to hold the information found at the "i" position in the list. Then, I create a temporary String to hold my description from the object I just retrieved. If the description matches the explicit parameter that is input, then I want it to return the index number at which it is found. My constant variable NO_MATCH is set equal to "-1", so my test is telling me that the gas station description does not exist when it clearly does.</strong></p>
  
  <pre><code>public int findStation(String toMatch)
  { 
      //returns the index where a match is found
      for (int i = 0; i &lt; stations.size(); i++)
      {
          Station tmpStation = stations.get(i);
          String tmpDescription = tmpStation.getDescription();
          if (tmpDescription.equals(toMatch))
          {
              return i;
          }
      }
      return NO_MATCH;
  }
  </code></pre>
  
  <p><strong>Also, the addStation() method used to add stations.</strong></p>
  
  <pre><code>public boolean addStation(double inLatitude, double inLongitude, 
      String inDescription, double inPrice, String inFuelType)
  {
      // Be sure inDescription is not a description in the collection
      if (this.findStation(inDescription) == NO_MATCH)
      {
          Station tmpStation = new Station();
          stations.add(tmpStation);
          return true;
      }
      else return false;
  } 
  </code></pre>
  
  <p><strong>Junit test including the setup() to give you an idea of what I'm working with.</strong></p>
  
  <pre><code>protected void setUp()
  {
      // collection for testing
      collection2 = new StationCollection();
  
      // add stations to the collection
      this.collection2.addStation(39.933611, -82.4725, 
          "Snake on the Lake", 2.99, "B80");
      this.collection2.addStation(39.9621, -83.0005, 
          "Snake Central", 2.25, "E45");
      this.collection2.addStation(39.94, -82.48, 
          "Snake Brothers", 2.27, "E45");
      this.collection2.addStation(39.8614, -82.8916, 
          "Anna Conda Oil", 2.71, "PROPANE");        
      this.collection2.addStation(39.8614, -82.8916, 
          "Anna Conda Oil - II", 2.27, "E45");
      this.collection2.addStation(39.9060, -82.7562, 
          "Tiger Snake", 2.31, "E40");
      this.collection2.addStation(39.9611, -82.9988, 
          "Rattler Ray's", 2.15, "E84");
      this.collection2.addStation(40.011792, -82.973196, 
          "Water Adder Oil", 3.20, "B80");
      this.collection2.addStation(40.011792, -82.974, 
          "Water Adder Oil - II", 2.31, "E40");
  }
  
  public void testFindStation()
  {
      // Create an empty collection
      StationCollection collection1 = new StationCollection();
  
      // Attempt to find a station in the empty collection        
      assertEquals(StationCollection.NO_MATCH, collection1.findStation("Rattler Ray's"));
  
      // Use non-empty collection2
  
      // Look for position of matching station
      assertEquals(6, collection2.findStation("Rattler Ray's"));
  
      // Check that it detects a non-matching station
      assertEquals(StationCollection.NO_MATCH, collection2.findStation("Sam Snake's"));  
  }
  </code></pre>