f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/test/java/io/protobase/f7/spreadsheet/GeneralErrorTest.java
-rw-r--r--
2607
 1package io.protobase.f7.spreadsheet;
 2
 3import io.protobase.f7.errors.DivException;
 4import io.protobase.f7.errors.NAException;
 5import io.protobase.f7.errors.NameException;
 6import io.protobase.f7.errors.NullException;
 7import io.protobase.f7.errors.NumException;
 8import io.protobase.f7.errors.ParseException;
 9import io.protobase.f7.errors.RefException;
10import io.protobase.f7.errors.ValueException;
11import io.protobase.f7.testutils.TestExecution;
12import org.junit.Test;
13
14public class GeneralErrorTest extends TestExecution {
15  @Test
16  public void test_NullError() {
17    runner().addCell("Alpha", "A1", "= #NULL!").addExpectedValue("Alpha", "A1", new NullException()).run();
18    runner().addCell("Alpha", "A1", "= #null!").addExpectedValue("Alpha", "A1", new NullException()).run();
19  }
20
21  @Test
22  public void test_DivError() {
23    runner().addCell("Alpha", "A1", "= #DIV/0!").addExpectedValue("Alpha", "A1", new DivException()).run();
24    runner().addCell("Alpha", "A1", "= #div/0!").addExpectedValue("Alpha", "A1", new DivException()).run();
25  }
26
27  @Test
28  public void test_ValueError() {
29    runner().addCell("Alpha", "A1", "= #VALUE!").addExpectedValue("Alpha", "A1", new ValueException()).run();
30    runner().addCell("Alpha", "A1", "= #value!").addExpectedValue("Alpha", "A1", new ValueException()).run();
31  }
32
33  @Test
34  public void test_RefError() {
35    runner().addCell("Alpha", "A1", "= #REF!").addExpectedValue("Alpha", "A1", new RefException()).run();
36    runner().addCell("Alpha", "A1", "= #ref!").addExpectedValue("Alpha", "A1", new RefException()).run();
37  }
38
39  @Test
40  public void test_NameError() {
41    runner().addCell("Alpha", "A1", "= #NAME?").addExpectedValue("Alpha", "A1", new NameException()).run();
42    runner().addCell("Alpha", "A1", "= #name?").addExpectedValue("Alpha", "A1", new NameException()).run();
43  }
44
45  @Test
46  public void test_NumError() {
47    runner().addCell("Alpha", "A1", "= #NUM!").addExpectedValue("Alpha", "A1", new NumException()).run();
48    runner().addCell("Alpha", "A1", "= #num!").addExpectedValue("Alpha", "A1", new NumException()).run();
49  }
50
51  @Test
52  public void test_NAError() {
53    runner().addCell("Alpha", "A1", "= #N/A").addExpectedValue("Alpha", "A1", new NAException()).run();
54    runner().addCell("Alpha", "A1", "= #n/a").addExpectedValue("Alpha", "A1", new NAException()).run();
55  }
56
57  @Test
58  public void test_ParseError() {
59    runner().addCell("Alpha", "A1", "= #ERROR!").addExpectedValue("Alpha", "A1", new ParseException()).run();
60    runner().addCell("Alpha", "A1", "= #error!").addExpectedValue("Alpha", "A1", new ParseException()).run();
61  }
62}