@Test public void shouldRegisterTemporaryWhenVisitingTemporary() { Temporaries temporaries = mock(Temporaries.class); Temporary temporary = mock(Temporary.class); analyser.visitBegin(temporaries); analyser.visit(temporary, "temp", 1); assertNotNull(analyser.temporariesRegistry()); assertEquals(1, analyser.temporariesRegistry().size()); assertEquals(0, (int) analyser.temporariesRegistry().get("temp")); assertEquals(1, analyser.temporariesIndex()); }
@Test public void shouldHaveNoTemporariesRegistryWhenCreated() { ProgramAnalyser programAnalyser = new ProgramAnalyser(parent, "foo", "com.domain", false); assertNull(programAnalyser.temporariesRegistry()); assertEquals(0, programAnalyser.temporariesIndex()); }