private String tryColor(String desc, String cname, CellValue getter, Object value, String expectedText, Color expectedColor) { if (cname != null) { desc = "[" + cname + "]" + desc; } Color origColor = labelForeColor; CellFormatPart format = new CellFormatPart(desc); CellFormatResult result = format.Apply(value); if (!result.Applies) { // If this doesn't Apply, no color change is expected expectedColor = origColor; } String actualText = result.Text; Color actualColor = labelForeColor; getter.Equivalent(expectedText, actualText, format); Assert.AreEqual( expectedColor, actualColor, cname == null ? "no color" : "color " + cname); return(actualText); }