@Test public void shouldRegisterAndInvokeCompilerOfBlockWhenVisitBeginOfBlock() { Block block = mock(Block.class); when(parent.className()).thenReturn("SomeClass"); when(parent.packageName()).thenReturn("st.redline"); ProgramAnalyser spy = spy(analyser); SmalltalkEnvironment smalltalkEnvironment = mock(SmalltalkEnvironment.class); doReturn(smalltalkEnvironment).when(spy).smalltalkEnvironment(); spy.visitBegin(block, 1); verify(smalltalkEnvironment).registerBlockToBeCompiled(block, "st.redline.SomeClass$M1"); verify(writer).invokeObjectCompileBlock("st.redline.SomeClass$M1", 1); }