@Test public void testRequestIdShouldContainFirstPartOfHostname() throws Exception { final String uuid = new UUIDGeneratorImpl().getNextUUID(); String host; try { host = InetAddress.getLocalHost().getHostName(); Pattern HOST_FINDER = Pattern.compile("([\\w\\d\\-]{1,30}+).*", Pattern.CASE_INSENSITIVE); Matcher m = HOST_FINDER.matcher(host); if (m.matches()) { host = m.group(1); } else { host = UUIDGeneratorImpl.DEFAULT_HOSTNAME; } } catch (UnknownHostException e) { host = UUIDGeneratorImpl.DEFAULT_HOSTNAME; } assertTrue("Request id should contain first part of hostname "+host, uuid.contains(host)); }
@Override public String getNextUUID() { return randomUUID(); }
UUIDGeneratorImpl implements UUIDGenerator { @Override public String getNextUUID() { return randomUUID(); } }
UUIDGeneratorImpl implements UUIDGenerator { @Override public String getNextUUID() { return randomUUID(); }  }
UUIDGeneratorImpl implements UUIDGenerator { @Override public String getNextUUID() { return randomUUID(); }  @Override String getNextUUID(); @Override String[] validateUuid(String uuid); }
UUIDGeneratorImpl implements UUIDGenerator { @Override public String getNextUUID() { return randomUUID(); }  @Override String getNextUUID(); @Override String[] validateUuid(String uuid); static final String DEFAULT_HOSTNAME; }