@Test public void testInvalidUserAgent() throws Exception { final IdWorker worker = new IdWorker(1, 1); assertFalse(worker.isValidUserAgent("1")); assertFalse(worker.isValidUserAgent("1asdf")); }
public boolean isValidUserAgent(final String agent) { if (!validateUserAgent) { return true; } final Matcher matcher = AGENT_PATTERN.matcher(agent); return matcher.matches(); }
IdWorker { public boolean isValidUserAgent(final String agent) { if (!validateUserAgent) { return true; } final Matcher matcher = AGENT_PATTERN.matcher(agent); return matcher.matches(); } }
IdWorker { public boolean isValidUserAgent(final String agent) { if (!validateUserAgent) { return true; } final Matcher matcher = AGENT_PATTERN.matcher(agent); return matcher.matches(); } IdWorker(final int workerId, final int datacenterId);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence);  IdWorker(final int workerId, final int datacenterId,
            final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent,
            final MetricRegistry registry); }
IdWorker { public boolean isValidUserAgent(final String agent) { if (!validateUserAgent) { return true; } final Matcher matcher = AGENT_PATTERN.matcher(agent); return matcher.matches(); } IdWorker(final int workerId, final int datacenterId);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence);  IdWorker(final int workerId, final int datacenterId,
            final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent,
            final MetricRegistry registry); long getId(final String agent); int getWorkerId(); int getDatacenterId(); long getTimestamp(); long getSequence(); void setSequence(final long value); synchronized long nextId(); boolean isValidUserAgent(final String agent); }
IdWorker { public boolean isValidUserAgent(final String agent) { if (!validateUserAgent) { return true; } final Matcher matcher = AGENT_PATTERN.matcher(agent); return matcher.matches(); } IdWorker(final int workerId, final int datacenterId);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence);  IdWorker(final int workerId, final int datacenterId,
            final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent);  IdWorker(final int workerId, final int datacenterId,
            final long startSequence, final boolean validateUserAgent,
            final MetricRegistry registry); long getId(final String agent); int getWorkerId(); int getDatacenterId(); long getTimestamp(); long getSequence(); void setSequence(final long value); synchronized long nextId(); boolean isValidUserAgent(final String agent); static final long TWEPOCH; }