final long expectedId = 2L;
mockStatic(IdGenerator.class);
when(IdGenerator.generateNewId()).thenReturn(expectedId);
// When
final Message message = myBean.generateMessage();
// Then
assertEquals(expectedId, message.getId());
assertEquals("John Doe, Paul Anderson, Jane Doe", message.getContent());
verifyStatic(); IdGenerator.generateNewId();
}