Powermock and static mockery are the way forward. You will need something like:
...
import static org.junit.Assert.assertEquals;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
...
@PrepareForTest({ UUID.class })
@RunWith(PowerMockRunner.class)
public class ATest
{
...
mockStatic(UUID.class);
when(UUID.randomUUID()).thenReturn("your-UUID");
...
}
Note that a static layout can be implemented in a method annotated with @Before, so it can be reused in all test cases that require a UUID to avoid repeating the code.
UUID - :
A a = doSomething();
assertEquals("your-UUID", a.getX());