IncludesFunction extends AlpharithmeticFunction { @Override public Object calculateValue() { if(checkValidity(input) == true){ String tempString1 = ""; String tempString2 = "a"; if(input[0].getCell() instanceof String && input[1].getCell() instanceof String){ tempString1 = (String)input[0].getCell(); tempString2 = (String)input[1].getCell(); } return (tempString1.toLowerCase().contains(tempString2.toLowerCase())); } else { return null; } } IncludesFunction(Cell[] input); @Override Object calculateValue();  }
@Test public void testCalculateValue() { Cell[] input = new Cell[2]; input[0] = new StringCell(0,0); input[1] = new StringCell(0,0); input[0].setCell("abcdefghijk"); input[1].setCell("lmnopqrs"); Function includesFunction = new IncludesFunction(input); assertFalse((Boolean)includesFunction.calculateValue()); input[0].setCell("abcd"); input[1].setCell("cdef"); includesFunction = new IncludesFunction(input); assertFalse((Boolean)includesFunction.calculateValue()); input[0].setCell("abcdefg"); input[1].setCell("efg"); includesFunction = new IncludesFunction(input); assertTrue((Boolean)includesFunction.calculateValue()); input[0].setCell("abcd"); input[1].setCell("333"); includesFunction = new IncludesFunction(input); assertFalse((Boolean)includesFunction.calculateValue()); }