retest.datatype.SecureRandomSeedDataType Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of retest Show documentation
Show all versions of retest Show documentation
ReTest is a JUnit extension perform Randomic Test with ease and simplicity.
It supports method parameters with Test annotation and much more.
The newest version!
/*
* ****************************************************************
* André Ivo
* [email protected]
* Created on : Jul 29, 2016, 3:04:54 PM
* ****************************************************************
*/
package retest.datatype;
import java.util.Random;
import retest.utils.SecureRandomSeed;
/**
*
* @author andreivo
*/
public class SecureRandomSeedDataType extends DataType {
@Override
public SecureRandomSeed deserialize(String value) {
Long aLong = Long.decode(value);
SecureRandomSeed rs = new SecureRandomSeed(aLong);
return rs;
}
@Override
public SecureRandomSeed randomizeParam() {
Random rseed = new Random(10000);
SecureRandomSeed r = new SecureRandomSeed(System.currentTimeMillis() - rseed.nextLong());
return r;
}
@Override
public String serialize(SecureRandomSeed value) {
return value.toString();
}
}