poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58787] [In progress] Border Drawing utility that does not create unnecessary styles
Date Sun, 24 Jan 2016 01:13:13 GMT

--- Comment #12 from Javen O'Neal <onealj@apache.org> ---
(In reply to Mark Murphy from comment #5)
> Not real sure how to write unit tests for this since I need to
> look at the generated spreadsheet to determine if it worked or not. I could
> use some coaching on that.

Sometimes writing unit tests is tough. At the bare minimum, a unit test can be
used to show someone how the code was intended to be used (this works great as
example code if you exclude the assertions). Unit tests should say what your
code should and should not do. For example, createBorder(region, ALL) should
create a left border on all cells in the first column of region, and should not
create a left border on any column to the right of the first column in the

You can and should review your results by opening the file in Excel, but that's
probably the last time your feature will be tested using Excel unless there's a

Your unit test will have to assume some functionality is implemented
correctly--which is fair to say about anything that the test wasn't explicitly
written to test. This might mean writing:

cell = row.createCell(0);
//blank/empty cells don't have any style to start with.
assertEquals(0, Util.getNumOfBorders(cell));

Util.setBorder(cell, LEFT);
assertTrue(Util.isBorderSet(cell, LEFT));
// the right border should not be set
assertFalse(Util.isBorderSet(cell, RIGHT));

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message