name:
src/test/java/io/protobase/f7/testutils/TestFormula.java
-rw-r--r--
2491
1package io.protobase.f7.testutils;
2
3import io.protobase.f7.models.A1Key;
4import io.protobase.f7.models.CellQuery;
5import io.protobase.f7.models.GridColumnRowKey;
6import org.mockito.Mock;
7
8import java.util.function.BiFunction;
9import java.util.function.Function;
10
11import static org.mockito.Mockito.mock;
12
13public class TestFormula {
14 protected static final GridColumnRowKey A1 = new GridColumnRowKey("Alpha", A1Key.fromString("A1").toColumnRowKey());
15 protected static final GridColumnRowKey M22 = new GridColumnRowKey("Alpha", A1Key.fromString("M22").toColumnRowKey());
16 protected static final CellQuery M22_RANGE = CellQuery.builder()
17 .grid("Alpha")
18 .columnsBetween(M22.getColumnIndex(), M22.getColumnIndex())
19 .rowsBetween(M22.getRowIndex(), M22.getRowIndex())
20 .build();
21
22 protected static final GridColumnRowKey G19 = new GridColumnRowKey("Alpha", A1Key.fromString("G19").toColumnRowKey());
23 protected static final CellQuery G19_RANGE = CellQuery.builder()
24 .grid("Alpha")
25 .columnsBetween(G19.getColumnIndex(), G19.getColumnIndex())
26 .rowsBetween(G19.getRowIndex(), G19.getRowIndex())
27 .build();
28
29 protected static final GridColumnRowKey J6 = new GridColumnRowKey("Alpha", A1Key.fromString("J6").toColumnRowKey());
30 protected static final CellQuery J6_RANGE = CellQuery.builder()
31 .grid("Alpha")
32 .columnsBetween(J6.getColumnIndex(), J6.getColumnIndex())
33 .rowsBetween(J6.getRowIndex(), J6.getRowIndex())
34 .build();
35
36 protected static final GridColumnRowKey D1 = new GridColumnRowKey("Alpha", A1Key.fromString("D1").toColumnRowKey());
37 protected static final GridColumnRowKey D3 = new GridColumnRowKey("Alpha", A1Key.fromString("D3").toColumnRowKey());
38 protected static final GridColumnRowKey D5 = new GridColumnRowKey("Alpha", A1Key.fromString("D5").toColumnRowKey());
39 protected static final CellQuery D1_TO_D3_RANGE = CellQuery.builder()
40 .grid("Alpha")
41 .columnsBetween(D1.getColumnIndex(), D3.getColumnIndex())
42 .rowsBetween(D1.getRowIndex(), D3.getRowIndex())
43 .build();
44 protected static final CellQuery D1_TO_D5_RANGE = CellQuery.builder()
45 .grid("Alpha")
46 .columnsBetween(D1.getColumnIndex(), D5.getColumnIndex())
47 .rowsBetween(D1.getRowIndex(), D5.getRowIndex())
48 .build();
49
50 @Mock
51 protected Function<Object, Object> lookup = mock(Function.class);
52
53 @Mock
54 protected BiFunction<GridColumnRowKey, Object, Object> collateralLookup = mock(BiFunction.class);
55}