### Question:
IdWorker { public long getId(final String agent) throws InvalidUserAgentError, InvalidSystemClock { if (!isValidUserAgent(agent)) { exceptionsCounter.inc(); throw new InvalidUserAgentError(); } final long id = nextId(); genCounter(agent); return id; } 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; }### Answer:
@Test public void testGetIdInvalidUserAgent() throws Exception { final IdWorker worker = new IdWorker(1, 1); try { worker.getId("1"); failBecauseExceptionWasNotThrown(InvalidUserAgentError.class); } catch (InvalidUserAgentError e) { } }
@Test public void testGetId() throws Exception { final IdWorker worker = new IdWorker(1, 1); final long id = worker.getId("infra-dm"); assertThat(id).isGreaterThan(0L); }