jeudi 31 mars 2016

Test Serialization and Deserialization of objects in Java

Earlier, I had a java class:

public enum Currency
{
   PENNY,
   NICKLE,
   DIME,
   QUARTER;
}

Now I have made changes in the class and it looks like this:

public enum Currency
{
    PENNY("Penny"),
    NICKLE("Nickle"),
    DIME("Dime"),
    QUARTER("Quarter");

/**
 * Instantiates a new currency.
 * 
 * @param currencyType the currency type
 */
Currency(String currencyType)
{
    this.value = currencyType;
}

String value;

/**
 * Gets the value
 *
 */
public String getValue()
{
    return this.value;
}

}

I want to check if the Currency class object is getting serialized and deserialized properly. How should I check this through unit testing in java ?

Aucun commentaire:

Enregistrer un commentaire