### Question:
PidRuntimeFactory { public @Nonnull ThreadDumpRuntime fromCurrentProcess() throws IOException, InterruptedException { final String jvmName = ManagementFactory.getRuntimeMXBean().getName(); final int index = jvmName.indexOf('@'); if (index < 1) throw new IOException("Unable to extract PID from " + jvmName); long pid; try { pid = Long.parseLong(jvmName.substring(0, index)); } catch (NumberFormatException e) { throw new IOException("Unable to extract PID from " + jvmName); } return fromProcess(pid); } PidRuntimeFactory();  PidRuntimeFactory(@Nonnull String javaHome); PidRuntimeFactory failOnErrors(boolean failOnErrors); @Nonnull ThreadDumpRuntime fromProcess(long pid); @Nonnull ThreadDumpRuntime fromProcess(int pid); @Nonnull ThreadDumpRuntime fromProcess(@Nonnull Process process); @Nonnull ThreadDumpRuntime fromCurrentProcess();  }### Answer:
@Test public void fromCurrentProcess() throws Exception { String pattern = "com.github.olivergondza.dumpling.factory.PidRuntimeFactoryTest.fromCurrentProcess"; ThreadDumpThread main = new PidRuntimeFactory().fromCurrentProcess().getThreads().where(evaluating(pattern)).onlyThread(); assertEquals(Thread.currentThread().getName(), main.getName()); }