Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Fixture - Find Highest Number Only

Code Block
languagejava
titleFindHighestNumberFixture.java
linenumberstrue
package com.celestial.tdd.fitnesse.demo;

import com.celestial.tdd.demo.complete.ArrayUtils;
import com.celestial.tdd.demo.complete.EmptyArrayException;
import java.util.Arrays;

/**
 *
 * @author Selvyn
 */
public class FindHighestNumberFixture
{
    int[] arrayOfInts;
    
    public  void    setNumbers( String vals )
    {
        arrayOfInts = Arrays.stream(vals.split(","))
                 .mapToInt(Integer::parseInt)
                 .toArray();
    }
    
    public  int  ExpectedValue()
    {
        ArrayUtils cut = new ArrayUtils();
        
        try
        {
            return cut.findHighest(arrayOfInts);
        } catch (EmptyArrayException ex)
        {
            return -1;
        }
    }
    
    public  void    setNumbersList( int[] vals )
    {
        arrayOfInts = vals;
    }
}