use of alma.acs.logging.tools.CSVConverter in project ACS by ACS-Community.
the class ConvertersTest method testCSVConverterAllFields.
/**
* Test the CSV converter whose converted string
* contains all the log fields
*
* @throws Exception
*/
public void testCSVConverterAllFields() throws Exception {
CSVConverter converter = new CSVConverter();
assertNotNull(converter);
String ret = converter.convert(logToConvert);
assertNotNull(ret);
assertFalse("The convertion returned an empty string", ret.isEmpty());
// Build the string that the converted should have returned
StringBuilder testSB = new StringBuilder();
for (String str : logFields) {
if (str.equals(type) || str.equals(message)) {
testSB.append('"');
testSB.append(str);
testSB.append('"');
} else {
testSB.append(str);
}
testSB.append(',');
}
testSB.append("\"[");
testSB.append(DataName1.replaceAll("\"", ""));
testSB.append(" ==> ");
testSB.append(DataValue1);
testSB.append("] [");
testSB.append(DataName2.replaceAll("\"", ""));
testSB.append(" ==> ");
testSB.append(DataValue2);
testSB.append("]\"\n");
assertEquals(testSB.toString(), ret);
}
Aggregations