Here is the scenario:
I generate Random Data in one class and use it as an argument in a method in the same class.
How can i use the exact same value in another class ?
Here is a simplified version of my classes:
public class A {
@Test
public void aMethod() {
RandomStringUUID ruuid = new RandomStringUUID();
}
}
Then:
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
}
}
Make your variable a public static variable in class A
After the beatdown I’m getting in the voting count
Not enough info on the OP’s part to infer it’s design rules or just a simple JAVA question on how to get a Variable from Class to Class. 😀