public String toString() { StringBuffer sb = new StringBuffer(ISOUtil.strpad (name, 50)); sb.append (" ["); sb.append (getResultCodeAsString()); sb.append ("] "); sb.append (elapsed()); sb.append ("ms."); return sb.toString(); } public void start() {
private void showAll(CLIContext cli, boolean detail) { NameRegistrar nr = NameRegistrar.getInstance(); int maxw = 0; Iterator iter = NameRegistrar.getAsMap().entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); maxw = Math.max(maxw, entry.getKey().toString().length()); } iter = NameRegistrar.getAsMap().entrySet().iterator(); maxw++; while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); cli.println( ISOUtil.strpad(entry.getKey().toString(), maxw) + entry.getValue().toString() ); if (detail && entry.getValue() instanceof Loggeable) { cli.printLoggeable((Loggeable) entry.getValue(), " "); } } } }
/** * @param c - a component * @return packed component * @exception ISOException */ public byte[] pack (ISOComponent c) throws ISOException { String s = ISOUtil.strpad ((String) c.getValue(), getLength()); return ISOUtil.asciiToEbcdic(s); } /**
@Test(expected = NullPointerException.class) public void testStrpadThrowsNullPointerException() throws Throwable { ISOUtil.strpad(null, 100); }
case 'A': if (!isSeparated(separator)) { value = ISOUtil.strpad (value, length);
@Test public void testStrpad() throws Throwable { String result = ISOUtil.strpad("testISOUtils", 0); assertEquals("result", "testISOUtils", result); }
@Test public void testStrpad1() throws Throwable { String result = ISOUtil.strpad("testISOUtils", 100); assertEquals("result", "testISOUtils ", result); }