FileDocCategorySizeDatePackage
TestUtils.javaAPI DocAndroid 1.5 API2500Wed May 06 22:41:06 BST 2009org.apache.harmony.security.tests.support

TestUtils

public class TestUtils extends Object
Test utility class

Fields Summary
Constructors Summary
private TestUtils()
No need to instantiate

    
Methods Summary
public static voidprintAsHex(int perLine, java.lang.String prefix, java.lang.String delimiter, byte[] data)
Prints byte array data as hex to the System.out in the customizable form.

param
perLine how many numbers put on single line
param
prefix custom output number prefix
param
delimiter custom output number delimiter
param
data data to be printed

        for (int i=0; i<data.length; i++) {
            String tail = Integer.toHexString(0x000000ff & data[i]);
            if (tail.length() == 1) {
                tail = "0" + tail; 
            }
            System.out.print(prefix + "0x" + tail + delimiter);

            if (((i+1)%perLine) == 0) {
                System.out.println("");
            }
        }
        System.out.println("");
    
public static voidsetSystemProperty(java.lang.String key, java.lang.String value)
Sets system property

param
key - the name of the system property.
param
value - the value to be set

        Properties properties = System.getProperties();
        if (value == null) {
            properties.remove(key);
        } else {
            properties.setProperty(key, value);
        }
        System.setProperties(properties);