### Question:
Nazgul { public static Nazgul getInstance(NazgulName name) { return nazguls.get(name); } private  Nazgul(NazgulName name); static Nazgul getInstance(NazgulName name); NazgulName getName();  }### Answer:
@Test public void testGetInstance() { for (final var name : NazgulName.values()) { final var nazgul = Nazgul.getInstance(name); assertNotNull(nazgul); assertSame(nazgul, Nazgul.getInstance(name)); assertEquals(name, nazgul.getName()); } }
@Test public void testGetInstance() { for (final NazgulName name : NazgulName.values()) { final Nazgul nazgul = Nazgul.getInstance(name); assertNotNull(nazgul); assertSame(nazgul, Nazgul.getInstance(name)); assertEquals(name, nazgul.getName()); } }