Package org.apache.poi.ss.formula.eval

Examples of org.apache.poi.ss.formula.eval.StringEval


* @author cedric dot walter @ gmail dot com
*/
public final class TestHex2Dec extends TestCase {

    private static ValueEval invokeValue(String number1) {
    ValueEval[] args = new ValueEval[] { new StringEval(number1) };
    return new Hex2Dec().evaluate(args, -1, -1);
  }
View Full Code Here


        assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(new ValueEval[4], null));
    }

    public void testFailWhenArgumentsAreNotDatesNorNumbers() {
        assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(
                new ValueEval[]{ new StringEval("Potato"), new StringEval("Cucumber") }, EC));
    }
View Full Code Here

                new ValueEval[]{ new StringEval("Potato"), new StringEval("Cucumber") }, EC));
    }

    public void testReturnWorkdays() {
        assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(151) }, EC)).getNumberValue()));
    }
View Full Code Here

    public void testReturnWorkdaysSpanningAWeekendSubtractingDays() {
      String startDate = "2013/09/30";
      int days = -1;
      String expectedWorkDay = "2013/09/27";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

   
    public void testReturnWorkdaysSpanningAWeekendAddingDays() {
      String startDate = "2013/09/27";
      int days = 1;
      String expectedWorkDay = "2013/09/30";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

   
    public void testReturnWorkdaysWhenStartIsWeekendAddingDays() {
      String startDate = "2013/10/06";
      int days = 1;
      String expectedWorkDay = "2013/10/07";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

   
    public void testReturnWorkdaysWhenStartIsWeekendSubtractingDays() {
      String startDate = "2013/10/06";
      int days = -1;
      String expectedWorkDay = "2013/10/04";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }

    public void testReturnWorkdaysWithDaysTruncated() {
        assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(151.99999) }, EC)).getNumberValue()));
    }
View Full Code Here

                new StringEval(STARTING_DATE.toString()), new NumberEval(151.99999) }, EC)).getNumberValue()));
    }

    public void testReturnRetroativeWorkday() {
        assertEquals(new Date(108, SEPTEMBER, 23), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY.toString()) }, EC))
                .getNumberValue()));
    }
View Full Code Here

                .getNumberValue()));
    }

    public void testReturnNetworkdaysWithManyHolidays() {
        assertEquals(new Date(109, MAY, 5), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(151),
                new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY) }, EC)).getNumberValue()));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.eval.StringEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.