### Question:
JvmRuntimeFactory { public @Nonnull JvmRuntime currentRuntime() { IllegalRuntimeStateException error = null; for (int retry = 0; retry < 10; retry++) { try { return _currentRuntime(); } catch (IllegalRuntimeStateException ex) { error = ex; } } throw error; }  @Nonnull JvmRuntime currentRuntime();  }### Answer:
@Test public void extractThread() { JvmThreadSet threads = new JvmRuntimeFactory().currentRuntime().getThreads(); Thread currentThread = Thread.currentThread(); assertThat(currentThread.getId(), equalTo(threads.forCurrentThread().getId())); assertThat(currentThread.getId(), equalTo(threads.forThread(currentThread).getId())); assertNull(threads.forThread(null)); assertNull(threads.forThread(new Thread())); }
@Test public void groupName() throws Exception { JvmThreadSet threads = new JvmRuntimeFactory().currentRuntime().getThreads(); Thread actual = Thread.currentThread(); JvmThread extracted = threads.forCurrentThread(); String actualName = actual.getThreadGroup().getName(); assertThat(actualName, equalTo(extracted.getGroupName())); assertThat(extracted.toString(), containsString("groupName=\"" + actualName + "\"")); }