for ( EscherProperty property : properties )
{
- stringBuilder.append( " " + property.toString() + nl );
+ stringBuilder.append(" ").append(property.toString()).append(nl);
}
return stringBuilder.toString();
}
Constructor<? extends EscherRecord> recordConstructor = recordsMap.get(Short.valueOf(recordId));
- EscherRecord escherRecord = null;
+ final EscherRecord escherRecord;
if (recordConstructor == null) {
return new UnknownEscherRecord();
}
try {
- escherRecord = recordConstructor.newInstance(new Object[] {});
+ escherRecord = recordConstructor.newInstance();
} catch (Exception e) {
return new UnknownEscherRecord();
}
Map<Short, Constructor<? extends EscherRecord>> result = new HashMap<Short, Constructor<? extends EscherRecord>>();
final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
- for (int i = 0; i < recClasses.length; i++) {
+ for (Class<?> recClass : recClasses) {
@SuppressWarnings("unchecked")
- Class<? extends EscherRecord> recCls = (Class<? extends EscherRecord>) recClasses[i];
+ Class<? extends EscherRecord> recCls = (Class<? extends EscherRecord>) recClass;
short sid;
try {
sid = recCls.getField("RECORD_ID").getShort(null);
}
Constructor<? extends EscherRecord> constructor;
try {
- constructor = recCls.getConstructor( EMPTY_CLASS_ARRAY );
+ constructor = recCls.getConstructor(EMPTY_CLASS_ARRAY);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
EscherComplexProperty escherComplexProperty = (EscherComplexProperty) o;
- if ( !Arrays.equals( _complexData, escherComplexProperty._complexData ) ) return false;
+ return Arrays.equals(_complexData, escherComplexProperty._complexData);
- return true;
}
/**
@Override
public String toXml(String tab){
- StringBuilder builder = new StringBuilder();
- builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId()))
- .append("\" name=\"").append(getName()).append("\" blipId=\"")
- .append(isBlipId()).append("\">\n");
+ return tab + "<" + getClass().getSimpleName() + " id=\"0x" + HexDump.toHex(getId()) +
+ "\" name=\"" + getName() + "\" blipId=\"" +
+ isBlipId() + "\">\n" +
+ tab + "</" + getClass().getSimpleName() + ">\n";
//builder.append("\t").append(tab).append(dataStr);
- builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
- return builder.toString();
}
}
==================================================================== */
package org.apache.poi.ddf;
-import org.apache.poi.util.HexDump;
import org.apache.poi.util.Internal;
/**
super.setVersion( value );
}
-
- @Override
- public String toXml(String tab) {
- StringBuilder builder = new StringBuilder();
- builder.append(tab).append(formatXmlRecordHeader(getClass().getSimpleName(), HexDump.toHex(getRecordId()), HexDump.toHex(getVersion()), HexDump.toHex(getInstance())));
- for (EscherProperty property: getEscherProperties()){
- builder.append(property.toXml(tab+"\t"));
- }
- builder.append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
- return builder.toString();
- }
}
package org.apache.poi.ddf;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.poi.util.LittleEndian;
}
// Get complex data
- for (Iterator<EscherProperty> iterator = results.iterator(); iterator.hasNext();) {
- EscherProperty p = iterator.next();
+ for (EscherProperty p : results) {
if (p instanceof EscherComplexProperty) {
if (p instanceof EscherArrayProperty) {
pos += ((EscherArrayProperty)p).setArrayData(data, pos);
} else {
byte[] complexData = ((EscherComplexProperty)p).getComplexData();
- int leftover = data.length-pos;
- if(leftover < complexData.length){
+ int leftover = data.length - pos;
+ if (leftover < complexData.length) {
throw new IllegalStateException("Could not read complex escher property, lenght was " + complexData.length + ", but had only " +
leftover + " bytes left");
}
protected int readHeader( byte[] data, int offset ) {
_options = LittleEndian.getShort( data, offset );
_recordId = LittleEndian.getShort( data, offset + 2 );
- int remainingBytes = LittleEndian.getInt( data, offset + 4 );
- return remainingBytes;
+ return LittleEndian.getInt( data, offset + 4 );
}
/**
* @return xml representation of this record
*/
public String toXml(String tab){
- StringBuilder builder = new StringBuilder();
- builder.append(tab).append("<").append(getClass().getSimpleName()).append(">\n")
- .append(tab).append("\t").append("<RecordId>0x").append(HexDump.toHex(_recordId)).append("</RecordId>\n")
- .append(tab).append("\t").append("<Options>").append(_options).append("</Options>\n")
- .append(tab).append("</").append(getClass().getSimpleName()).append(">\n");
- return builder.toString();
+ return tab + "<" + getClass().getSimpleName() + ">\n" +
+ tab + "\t" + "<RecordId>0x" + HexDump.toHex(_recordId) + "</RecordId>\n" +
+ tab + "\t" + "<Options>" + _options + "</Options>\n" +
+ tab + "</" + getClass().getSimpleName() + ">\n";
}
protected String formatXmlRecordHeader(String className, String recordId, String version, String instance){
- StringBuilder builder = new StringBuilder();
- builder.append("<").append(className).append(" recordId=\"0x").append(recordId).append("\" version=\"0x")
- .append(version).append("\" instance=\"0x").append(instance).append("\" size=\"").append(getRecordSize()).append("\">\n");
- return builder.toString();
+ return "<" + className + " recordId=\"0x" + recordId + "\" version=\"0x" +
+ version + "\" instance=\"0x" + instance + "\" size=\"" + getRecordSize() + "\">\n";
}
public String toXml(){
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
// Generate record
String destinationPath = destSrcPathDir + "/" + packageName;
File destinationPathFile = new File(destinationPath);
- if (destinationPathFile.mkdirs()) {
- System.out.println("Created destination directory: " + destinationPath);
+ if(!destinationPathFile.mkdirs()) {
+ throw new IOException("Could not create directory " + destinationPathFile);
+ } else {
+ System.out.println("Created destination directory: " + destinationPath);
}
String destinationFilepath = destinationPath + "/" + recordName + suffix + ".java";
transform(file, new File(destinationFilepath),
// Generate test (if not already generated)
destinationPath = testSrcPathDir + "/" + packageName;
destinationPathFile = new File(destinationPath);
- if (destinationPathFile.mkdirs()) {
+ if(!destinationPathFile.mkdirs()) {
+ throw new IOException("Could not create directory " + destinationPathFile);
+ } else {
System.out.println("Created destination directory: " + destinationPath);
}
destinationFilepath = destinationPath + "/Test" + recordName + suffix + ".java";
- if (new File(destinationFilepath).exists() == false) {
+ if (!new File(destinationFilepath).exists()) {
String temp = (recordStyleDir + "/" + extendstg.toLowerCase(Locale.ROOT) + "_test.xsl");
transform(file, new File(destinationFilepath), new File(temp));
System.out.println("Generated test: " + destinationFilepath);
/**
* <p>The length of the property set stream header.</p>
*/
- private final int OFFSET_HEADER =
+ private final static int OFFSET_HEADER =
BYTE_ORDER_ASSERTION.length + /* Byte order */
FORMAT_ASSERTION.length + /* Format */
LittleEndianConsts.INT_SIZE + /* OS version */
{
/* Write the number of sections in this property set stream. */
final int nrSections = sections.size();
- int length = 0;
/* Write the property set's header. */
- length += TypeWriter.writeToStream(out, (short) getByteOrder());
- length += TypeWriter.writeToStream(out, (short) getFormat());
- length += TypeWriter.writeToStream(out, getOSVersion());
- length += TypeWriter.writeToStream(out, getClassID());
- length += TypeWriter.writeToStream(out, nrSections);
+ TypeWriter.writeToStream(out, (short) getByteOrder());
+ TypeWriter.writeToStream(out, (short) getFormat());
+ TypeWriter.writeToStream(out, getOSVersion());
+ TypeWriter.writeToStream(out, getClassID());
+ TypeWriter.writeToStream(out, nrSections);
int offset = OFFSET_HEADER;
/* Write the section list, i.e. the references to the sections. Each
final ClassID formatID = s.getFormatID();
if (formatID == null)
throw new NoFormatIDException();
- length += TypeWriter.writeToStream(out, s.getFormatID());
- length += TypeWriter.writeUIntToStream(out, offset);
+ TypeWriter.writeToStream(out, s.getFormatID());
+ TypeWriter.writeUIntToStream(out, offset);
try
{
offset += s.getSize();
import java.util.List;
import org.apache.poi.hpsf.wellknown.SectionIDMap;
+import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
/**
* <p>The "byteOrder" field must equal this value.</p>
*/
static final byte[] BYTE_ORDER_ASSERTION =
- new byte[] {(byte) 0xFE, (byte) 0xFF};
+ {(byte) 0xFE, (byte) 0xFF};
/**
* <p>Specifies this {@link PropertySet}'s byte order. See the
* <p>The "format" field must equal this value.</p>
*/
static final byte[] FORMAT_ASSERTION =
- new byte[]{(byte) 0x00, (byte) 0x00};
+ {(byte) 0x00, (byte) 0x00};
/**
* <p>Specifies this {@link PropertySet}'s format. See the HPFS
{
final int avail = stream.available();
final byte[] buffer = new byte[avail];
- stream.read(buffer, 0, buffer.length);
+ IOUtils.readFully(stream, buffer);
init(buffer, 0, buffer.length);
}
else
* @return <code>true</code> if the objects are equal, <code>false</code>
* if not
*/
+ @Override
public boolean equals(final Object o)
{
if (o == null || !(o instanceof PropertySet))
*/
public String toString()
{
- final StringBuffer b = new StringBuffer();
+ final StringBuilder b = new StringBuilder();
final int sectionCount = getSectionCount();
b.append(getClass().getName());
b.append('[');
import java.io.File;
import java.io.IOException;
-import java.util.Iterator;
import org.apache.poi.POIDocument;
import org.apache.poi.POIOLE2TextExtractor;
}
DocumentSummaryInformation dsi = document.getDocumentSummaryInformation();
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
// Normal properties
text.append( getPropertiesText(dsi) );
// Now custom ones
CustomProperties cps = dsi == null ? null : dsi.getCustomProperties();
if (cps != null) {
- Iterator<String> keys = cps.nameSet().iterator();
- while (keys.hasNext()) {
- String key = keys.next();
- String val = HelperPropertySet.getPropertyValueText( cps.get(key) );
- text.append(key + " = " + val + "\n");
+ for (String key : cps.nameSet()) {
+ String val = HelperPropertySet.getPropertyValueText(cps.get(key));
+ text.append(key).append(" = ").append(val).append("\n");
}
}
return "";
}
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
PropertyIDMap idMap = ps.getPropertySetIDMap();
Property[] props = ps.getProperties();
- for (int i=0; i<props.length; i++) {
- String type = Long.toString( props[i].getID() );
- Object typeObj = idMap.get(props[i].getID());
- if(typeObj != null) {
+ for (Property prop : props) {
+ String type = Long.toString(prop.getID());
+ Object typeObj = idMap.get(prop.getID());
+ if (typeObj != null) {
type = typeObj.toString();
}
- String val = HelperPropertySet.getPropertyValueText( props[i].getValue() );
- text.append(type + " = " + val + "\n");
+ String val = HelperPropertySet.getPropertyValueText(prop.getValue());
+ text.append(type).append(" = ").append(val).append("\n");
}
return text.toString();
public POITextExtractor getMetadataTextExtractor() {
throw new IllegalStateException("You already have the Metadata Text Extractor, not recursing!");
}
-
+
private static abstract class HelperPropertySet extends SpecialPropertySet {
public HelperPropertySet() {
super(null);
}
}
+ @Override
+ public boolean equals(Object o) {
+ return super.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
public static void main(String[] args) throws IOException {
for (String file : args) {
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
public String toString() {
CellReference crA = new CellReference(getFirstRow(), getFirstColumn());
CellReference crB = new CellReference(getLastRow(), getLastColumn());
- StringBuffer sb = new StringBuffer();
- sb.append(getClass().getName()).append("[");
- sb.append(_evaluator.getSheetNameRange());
- sb.append('!');
- sb.append(crA.formatAsString());
- sb.append(':');
- sb.append(crB.formatAsString());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + "[" +
+ _evaluator.getSheetNameRange() +
+ '!' +
+ crA.formatAsString() +
+ ':' +
+ crB.formatAsString() +
+ "]";
}
/**
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
// handle these ourselves in a special way.
// For now, if we detect 3+ parts, we call out to CellFormat to handle it
// TODO Going forward, we should really merge the logic between the two classes
- if (formatStr.indexOf(";") != -1 &&
+ if (formatStr.contains(";") &&
formatStr.indexOf(';') != formatStr.lastIndexOf(';')) {
try {
// Ask CellFormat to get a formatter for it
String match = m.group();
String symbol = match.substring(match.indexOf('$') + 1, match.indexOf('-'));
if (symbol.indexOf('$') > -1) {
- StringBuffer sb = new StringBuffer();
- sb.append(symbol.substring(0, symbol.indexOf('$')));
- sb.append('\\');
- sb.append(symbol.substring(symbol.indexOf('$'), symbol.length()));
- symbol = sb.toString();
+ symbol = symbol.substring(0, symbol.indexOf('$')) +
+ '\\' +
+ symbol.substring(symbol.indexOf('$'), symbol.length());
}
formatStr = m.replaceAll(symbol);
m = localePatternGroup.matcher(formatStr);
return createDateFormat(formatStr, cellValue);
}
// Excel supports fractions in format strings, which Java doesn't
- if (formatStr.indexOf("#/") >= 0 || formatStr.indexOf("?/") >= 0) {
+ if (formatStr.contains("#/") || formatStr.contains("?/")) {
String[] chunks = formatStr.split(";");
- for (int i = 0; i < chunks.length; i++){
- String chunk = chunks[i].replaceAll("\\?", "#");
+ for (String chunk1 : chunks) {
+ String chunk = chunk1.replaceAll("\\?", "#");
Matcher matcher = fractionStripper.matcher(chunk);
chunk = matcher.replaceAll(" ");
chunk = chunk.replaceAll(" +", " ");
Matcher fractionMatcher = fractionPattern.matcher(chunk);
//take the first match
- if (fractionMatcher.find()){
+ if (fractionMatcher.find()) {
String wholePart = (fractionMatcher.group(1) == null) ? "" : defaultFractionWholePartFormat;
return new FractionFormat(wholePart, fractionMatcher.group(3));
}
Excel displays the month instead of minutes."
*/
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
char[] chars = formatStr.toCharArray();
boolean mIsMonth = true;
List<Integer> ms = new ArrayList<Integer>();
// if 'M' precedes 's' it should be minutes ('m')
for (int index : ms) {
if (sb.charAt(index) == 'M') {
- sb.replace(index, index+1, "m");
+ sb.replace(index, index + 1, "m");
}
}
mIsMonth = true;
}
private String cleanFormatForNumber(String formatStr) {
- StringBuffer sb = new StringBuffer(formatStr);
+ StringBuilder sb = new StringBuilder(formatStr);
if (emulateCSV) {
// Requested spacers with "_" are replaced by a single space.
* @see java.text.Format#format
*/
public void setDefaultNumberFormat(Format format) {
- Iterator<Map.Entry<String,Format>> itr = formats.entrySet().iterator();
- while(itr.hasNext()) {
- Map.Entry<String,Format> entry = itr.next();
+ for (Map.Entry<String, Format> entry : formats.entrySet()) {
if (entry.getValue() == generalNumberFormat) {
entry.setValue(format);
}
/** Format a number as an SSN */
public static String format(Number num) {
String result = df.format(num);
- StringBuffer sb = new StringBuffer();
- sb.append(result.substring(0, 3)).append('-');
- sb.append(result.substring(3, 5)).append('-');
- sb.append(result.substring(5, 9));
- return sb.toString();
+ return result.substring(0, 3) + '-' +
+ result.substring(3, 5) + '-' +
+ result.substring(5, 9);
}
@Override
/** Format a number as Zip + 4 */
public static String format(Number num) {
String result = df.format(num);
- StringBuffer sb = new StringBuffer();
- sb.append(result.substring(0, 5)).append('-');
- sb.append(result.substring(5, 9));
- return sb.toString();
+ return result.substring(0, 5) + '-' +
+ result.substring(5, 9);
}
@Override
/** Format a number as a phone number */
public static String format(Number num) {
String result = df.format(num);
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
String seg1, seg2, seg3;
int len = result.length();
if (len <= 4) {
seg2 = result.substring(Math.max(0, len - 7), len - 4);
seg1 = result.substring(Math.max(0, len - 10), Math.max(0, len - 7));
- if(seg1 != null && seg1.trim().length() > 0) {
+ if(seg1.trim().length() > 0) {
sb.append('(').append(seg1).append(") ");
}
- if(seg2 != null && seg2.trim().length() > 0) {
+ if(seg2.trim().length() > 0) {
sb.append(seg2).append('-');
}
sb.append(seg3);
}
}
}
- Byte[] polished = bytes.toArray( new Byte[0] );
+ Byte[] polished = bytes.toArray(new Byte[bytes.size()]);
byte[] rval = new byte[polished.length];
for ( int j = 0; j < polished.length; j++ )
{
* Helper class to extract text from an OOXML Word file
*/
public class XWPFWordExtractor extends POIXMLTextExtractor {
- public static final XWPFRelation[] SUPPORTED_TYPES = new XWPFRelation[]{
+ public static final XWPFRelation[] SUPPORTED_TYPES = {
XWPFRelation.DOCUMENT, XWPFRelation.TEMPLATE,
XWPFRelation.MACRO_DOCUMENT,
XWPFRelation.MACRO_TEMPLATE_DOCUMENT
if (run instanceof XWPFHyperlinkRun && fetchHyperlinks) {
XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
if (link != null)
- text.append(" <" + link.getURL() + ">");
+ text.append(" <").append(link.getURL()).append(">");
}
}
// Do endnotes and footnotes
String footnameText = paragraph.getFootnoteText();
if (footnameText != null && footnameText.length() > 0) {
- text.append(footnameText + '\n');
+ text.append(footnameText).append('\n');
}
if (ctSectPr != null) {
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public final class TestProper {
private Cell cell11;
final String scharfes = "\u00df"; //German lowercase eszett, scharfes s, sharp s
confirm("PROPER(\"stra"+scharfes+"e\")", "Stra"+scharfes+"e");
+ assertTrue(Character.isLetter(scharfes.charAt(0)));
// CURRENTLY FAILS: result: "SSUnd"+scharfes
// LibreOffice 5.0.3.2 behavior: "Sund"+scharfes
assertTrue(text.startsWith(
"Dates, all 24th November 2006\n"
));
- assertTrue(
- text.indexOf(
- "yyyy/mm/dd\t2006/11/24\n"
- ) > -1
- );
- assertTrue(
- text.indexOf(
- "yyyy-mm-dd\t2006-11-24\n"
- ) > -1
- );
- assertTrue(
- text.indexOf(
- "dd-mm-yy\t24-11-06\n"
- ) > -1
- );
+ assertTrue(text.contains("yyyy/mm/dd\t2006/11/24\n"));
+ assertTrue(text.contains("yyyy-mm-dd\t2006-11-24\n"));
+ assertTrue(text.contains("dd-mm-yy\t24-11-06\n"));
assertTrue("Had: " + text + ", but should contain 'nn.nn\\t10.52\\n'",
- text.indexOf(
- "nn.nn\t10.52\n"
- ) > -1
- );
- assertTrue(
- text.indexOf(
- "nn.nnn\t10.520\n"
- ) > -1
- );
- assertTrue(
- text.indexOf(
- "\u00a3nn.nn\t\u00a310.52\n"
- ) > -1
- );
+ text.contains("nn.nn\t10.52\n"));
+ assertTrue(text.contains("nn.nnn\t10.520\n"));
+ assertTrue(text.contains("\u00a3nn.nn\t\u00a310.52\n"));
extractor.close();
} finally {
LocaleUtil.setUserLocale(userLocale);
"45538_classic_Footer.xls", "45538_form_Footer.xls",
"45538_classic_Header.xls", "45538_form_Header.xls"
};
- for(int i=0; i<files.length; i++) {
- ExcelExtractor extractor = createExtractor(files[i]);
+ for (String file : files) {
+ ExcelExtractor extractor = createExtractor(file);
String text = extractor.getText();
- assertTrue("Unable to find expected word in text\n" + text, text.indexOf("testdoc") >=0);
- assertTrue("Unable to find expected word in text\n" + text, text.indexOf("test phrase") >= 0);
+ assertTrue("Unable to find expected word in text\n" + text, text.contains("testdoc"));
+ assertTrue("Unable to find expected word in text\n" + text, text.contains("test phrase"));
extractor.close();
}
}
String fmt = cell.getCellStyle().getDataFormatString();
//assert the correct month form, as in the original Excel format
- String monthPtrn = fmt.indexOf("mmmm") != -1 ? "MMMM" : "MMM";
+ String monthPtrn = fmt.contains("mmmm") ? "MMMM" : "MMM";
// this line is intended to compute how "July" would look like in the current locale
SimpleDateFormat sdf = new SimpleDateFormat(monthPtrn, LocaleUtil.getUserLocale());
sdf.setTimeZone(LocaleUtil.getUserTimeZone());
Calendar calDef = LocaleUtil.getLocaleCalendar(2010, 6, 15, 0, 0, 0);
String jul = sdf.format(calDef.getTime());
// special case for MMMMM = 1st letter of month name
- if(fmt.indexOf("mmmmm") > -1) {
+ if(fmt.contains("mmmmm")) {
jul = jul.substring(0,1);
}
// check we found july properly
- assertTrue("Format came out incorrect - " + fmt, fmtval.indexOf(jul) > -1);
+ assertTrue("Format came out incorrect - " + fmt, fmtval.contains(jul));
}
row = wb.getSheetAt(0).getRow(1);
// check we found the time properly
assertTrue("Format came out incorrect - " + fmt + " - found " + fmtval +
- ", but expected to find '11:23'", fmtval.indexOf("11:23") > -1);
+ ", but expected to find '11:23'", fmtval.contains("11:23"));
}
// test number formats
assertEquals("\u00a310.52", f.formatCellValue(sheet.getRow(12).getCell(1)));
}
- private static void log(String msg) {
+ private static void log(@SuppressWarnings("UnusedParameters") String msg) {
// if (false) { // successful tests should be silent
// System.out.println(msg);
// }
private static final String INVALID_FILE = HSSFTestDataSamples.getSampleFile("48936-strings.txt").getAbsolutePath();
private static final String INVALID_XLSX_FILE = HSSFTestDataSamples.getSampleFile("47668.xlsx").getAbsolutePath();
- private static final String[] DUMP_OPTIONS = new String[] {
+ private static final String[] DUMP_OPTIONS = {
"-dumprops",
"-dump-props",
"-dump-properties",
public void testColours() {
DataFormatter dfUS = new DataFormatter(Locale.US);
- String[] formats = new String[] {
+ String[] formats = {
"##.##",
"[WHITE]##.##",
"[BLACK]##.##;[RED]-##.##",
DataFormatter dfUS = new DataFormatter(Locale.US);
// Without currency symbols
- String[] formats = new String[] { "#,##0.00;[Blue](#,##0.00)" };
+ String[] formats = { "#,##0.00;[Blue](#,##0.00)" };
for (String format : formats) {
assertEquals(
"Wrong format for: " + format,
assertEquals("321 1/3", dfUS.formatRawCellContents(321.321, -1, "# ?/? ?/?"));
assertEquals("321 1/3", dfUS.formatRawCellContents(321.321, -1, "# ?/? #/# #/#"));
- // Where +ve has a fraction, but -ve doesnt, we currently show both
+ // Where +ve has a fraction, but -ve doesn't, we currently show both
assertEquals("123 1/3", dfUS.formatRawCellContents( 123.321, -1, "0 ?/?;0"));
//assertEquals("123", dfUS.formatRawCellContents(-123.321, -1, "0 ?/?;0"));
assertEquals(" 0.10 ", dfUS.formatRawCellContents( 0.1, -1, "_-* #,##0.00_-;-* #,##0.00_-;_-* \"-\"??_-;_-@_-"));
assertEquals("- 0.10 ", dfUS.formatRawCellContents(-0.1, -1, "_-* #,##0.00_-;-* #,##0.00_-;_-* \"-\"??_-;_-@_-"));
- // TODO Fix this, we are randomly adding a 0 at the end that souldn't be there
+ // TODO Fix this, we are randomly adding a 0 at the end that shouldn't be there
//assertEquals(" - ", dfUS.formatRawCellContents(0.0, -1, "_-* #,##0.00_-;-* #,##0.00_-;_-* \"-\"??_-;_-@_-"));
assertEquals(" $ 1.10 ", dfUS.formatRawCellContents( 1.1, -1, "_-$* #,##0.00_-;-$* #,##0.00_-;_-$* \"-\"??_-;_-@_-"));
assertEquals("-$ 1.10 ", dfUS.formatRawCellContents(-1.1, -1, "_-$* #,##0.00_-;-$* #,##0.00_-;_-$* \"-\"??_-;_-@_-"));
- // TODO Fix this, we are randomly adding a 0 at the end that souldn't be there
+ // TODO Fix this, we are randomly adding a 0 at the end that shouldn't be there
//assertEquals(" $ - ", dfUS.formatRawCellContents( 0.0, -1, "_-$* #,##0.00_-;-$* #,##0.00_-;_-$* \"-\"??_-;_-@_-"));
}