Commit 462b6f46 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed tests

parent f29662ca
......@@ -16,8 +16,8 @@
package org.croptrust.excel.templates;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
......@@ -70,7 +70,7 @@ public abstract class FunctionalTest extends JsonPathTest {
assertThat("0 indexed sheet must exist", sheet, not(nullValue()));
int lastRowNum = sheet.getLastRowNum();
assertThat("Expecting last row number=5 in the sheet", lastRowNum, is(5));
assertThat("Expecting last row number=5 in the sheet", lastRowNum, equalTo(5));
String[] columnMapping = new String[] {};
......@@ -79,7 +79,7 @@ public abstract class FunctionalTest extends JsonPathTest {
ExcelToJSON.EMPTY_JSON_OBJECT_STRING, true, true);
assertThat("5 Strings must be returned", jsonStrings, hasSize(5));
jsonStrings.stream().forEach(json -> {
assertThat("null value expected", json, is(nullValue()));
assertThat("null value expected", json, nullValue());
});
}
}
......
......@@ -16,10 +16,8 @@
package org.croptrust.excel.templates;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
import java.net.URISyntaxException;
......@@ -65,7 +63,7 @@ public class TemplatingTest extends JsonPathTest {
try (Workbook wb = WorkbookFactory.create(BasicExcelTest.TR_2016_XSLX)) {
for (int i = 0; i < wb.getNumberOfNames(); i++) {
Name name = wb.getNameAt(i);
wb.getNameAt(i);
}
}
}
......@@ -129,24 +127,24 @@ public class TemplatingTest extends JsonPathTest {
DocumentContext json = JsonPath.parse(jsonObject);
assertThat("Cell must contain the lastName", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E5")
.getStringCellValue(), is(json.read("$.traveller.lastName")));
.getStringCellValue(), equalTo(json.read("$.traveller.lastName")));
assertThat("Cell must contain the firstNames", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E6")
.getStringCellValue(), is(json.read("$.traveller.firstNames")));
.getStringCellValue(), equalTo(json.read("$.traveller.firstNames")));
assertThat("Cell must contain the email", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E9")
.getStringCellValue(), is(json.read("$.traveller.email")));
.getStringCellValue(), equalTo(json.read("$.traveller.email")));
assertThat("Cell must contain the phone", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E10")
.getStringCellValue(), is(json.read("$.traveller.phone")));
.getStringCellValue(), equalTo(json.read("$.traveller.phone")));
assertThat("Cell must contain the address", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E11")
.getStringCellValue(), is(json.read("$.traveller.address")));
.getStringCellValue(), equalTo(json.read("$.traveller.address")));
assertThat("Cell must contain the purpose", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!B14")
.getStringCellValue(), is(json.read("$.purpose")));
.getStringCellValue(), equalTo(json.read("$.purpose")));
assertThat("Cell must contain the benefit", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!B16")
.getStringCellValue(), is(json.read("$.benefit")));
.getStringCellValue(), equalTo(json.read("$.benefit")));
assertThat("Cell must contain the fwd", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!D19")
.getDateCellValue().getTime(), is(((Number) json.read("$.fwd")).longValue()));
.getDateCellValue().getTime(), equalTo(((Number) json.read("$.fwd")).longValue()));
assertThat("Cell must contain the lwd", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!I19")
.getDateCellValue().getTime(), is(((Number) json.read("$.lwd")).longValue()));
.getDateCellValue().getTime(), equalTo(((Number) json.read("$.lwd")).longValue()));
}
}
}
......@@ -194,15 +192,15 @@ public class TemplatingTest extends JsonPathTest {
DocumentContext json = JsonPath.parse(jsonObject);
assertThat("Cell must contain the unit", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!B23")
.getStringCellValue(), is(json.read("$.budgetCodes[0].unit")));
.getStringCellValue(), equalTo(json.read("$.budgetCodes[0].unit")));
assertThat("Cell must contain the account", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!C23")
.getStringCellValue(), is(json.read("$.budgetCodes[0].account")));
.getStringCellValue(), equalTo(json.read("$.budgetCodes[0].account")));
assertThat("Cell must contain the donor", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!D23")
.getStringCellValue(), is(json.read("$.budgetCodes[0].donor")));
.getStringCellValue(), equalTo(json.read("$.budgetCodes[0].donor")));
assertThat("Cell must contain the project", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!E23")
.getStringCellValue(), is(json.read("$.budgetCodes[0].project")));
.getStringCellValue(), equalTo(json.read("$.budgetCodes[0].project")));
assertThat("Cell must contain the activity", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!F23")
.getStringCellValue(), is(json.read("$.budgetCodes[0].activity")));
.getStringCellValue(), equalTo(json.read("$.budgetCodes[0].activity")));
}
}
}
......@@ -254,15 +252,15 @@ public class TemplatingTest extends JsonPathTest {
DocumentContext json = JsonPath.parse(jsonObject);
assertThat("Cell must contain the origin", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!B29")
.getStringCellValue(), is(json.read("$.itinerary[0].origin")));
.getStringCellValue(), equalTo(json.read("$.itinerary[0].origin")));
assertThat("Cell must contain the destination", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!D29")
.getStringCellValue(), is(json.read("$.itinerary[0].destination")));
.getStringCellValue(), equalTo(json.read("$.itinerary[0].destination")));
assertThat("Cell must contain the departure", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!F29")
.getDateCellValue().getTime(), is(((Number) json.read("$.itinerary[0].departure")).longValue()));
.getDateCellValue().getTime(), equalTo(((Number) json.read("$.itinerary[0].departure")).longValue()));
assertThat("Cell must contain the arrival", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!G29")
.getDateCellValue().getTime(), is(((Number) json.read("$.itinerary[0].arrival")).longValue()));
.getDateCellValue().getTime(), equalTo(((Number) json.read("$.itinerary[0].arrival")).longValue()));
assertThat("Cell must contain the budgetUnit", SpreadsheetUtil.getCell(wb, "'TA REQUEST-1'!I29")
.getStringCellValue(), is(json.read("$.itinerary[0].budgetUnit")));
.getStringCellValue(), equalTo(json.read("$.itinerary[0].budgetUnit")));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment