这是场景:我在一个类中生成随机数据并将其用作同一类中方法的参数。如何在另一个类中使用完全相同的值?
这是我的课程的简化版本:
public class A {
@Test
public void aMethod() {
RandomStringUUID ruuid = new RandomStringUUID();
}
}
然后:
public class B {
@Test
public void bMethod() {
// Want to use ruuid , without instantiating RandomStringUUID
// as i dont want new values, i want the one from class A
}
}