@Test
public void testSaveUpgradeStatus()
{

    UpgradeStatus upgradeStatus = null;
    String upgradeStatusFileName = null;
    Calendar cal = Calendar.getInstance();
    String timeInMillis = Long.toString( cal.getTimeInMillis() );
    // both null
    assertFalse( HmsUpgradeUtil.saveUpgradeStatus( upgradeStatusFileName, null ) );
    String id = UUID.randomUUID().toString();
    UpgradeStatusCode statusCode = UpgradeStatusCode.HMS_UPGRADE_INITIATED;
    upgradeStatus = new UpgradeStatus();
    upgradeStatus.setId( id );
    upgradeStatus.setStatusCode( statusCode );
    // fileName is null
    assertFalse( HmsUpgradeUtil.saveUpgradeStatus( upgradeStatusFileName, upgradeStatus ) );
    upgradeStatusFileName = upgradeDir + File.separator + timeInMillis + ".json";
    // UpgradeStatus in null
    assertFalse( HmsUpgradeUtil.saveUpgradeStatus( upgradeStatusFileName, null ) );
    assertTrue( HmsUpgradeUtil.saveUpgradeStatus( upgradeStatusFileName, upgradeStatus ) );
    File upgradeStatusFile = new File( upgradeStatusFileName );
    assertTrue( upgradeStatusFile.exists() && upgradeStatusFile.isFile() );
    assertTrue( upgradeStatusFile.delete() );
    File upgradeDirFile = new File( upgradeDir );
    if ( upgradeDirFile.exists() && upgradeDirFile.isDirectory() )
    {
        upgradeDirFile.delete();
    }
}