### Question:
DelegateExecutionImpl implements BuildingBlockExecution, Serializable { @JsonIgnore @Override public GeneralBuildingBlock getGeneralBuildingBlock() { try { final GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput"); if (generalBuildingBlock == null) { throw new MissingBuildingBlockInputException(MISSING_MSG); } return generalBuildingBlock; } catch (final ClassCastException e) { throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e); } } DelegateExecutionImpl(final Map<String, Serializable> seedMap);  DelegateExecutionImpl(final DelegateExecution execution); @JsonIgnore @Override GeneralBuildingBlock getGeneralBuildingBlock(); @Override T getVariable(final String key); @Override T getRequiredVariable(final String key); @Override void setVariable(final String key, final Serializable value); @JsonIgnore @Override Map<ResourceKey, String> getLookupMap(); @JsonIgnore @Override String getFlowToBeCalled(); @JsonIgnore @Override int getCurrentSequence(); void setDelegateExecution(final DelegateExecution execution); @JsonIgnore DelegateExecution getDelegateExecution();  }### Answer:
@Test public void getGeneralBuildingBlock() { final GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class); final Map<String, Serializable> map = new HashMap<>(); map.put("gBBInput", gBB); final DelegateExecutionImpl impl = create(map); assertEquals(gBB, impl.getGeneralBuildingBlock()); }
@Test public void getGeneralBuildingBlockNotFound() { final DelegateExecutionImpl impl = create(); thrown.expect(MissingBuildingBlockInputException.class); impl.getGeneralBuildingBlock(); }
@Test public void getGeneralBuildingBlockCastException() { final Map<String, Serializable> map = new HashMap<>(); map.put("gBBInput", new DelegateExecutionFake()); final DelegateExecutionImpl impl = create(map); thrown.expect(MalformedBuildingBlockInputException.class); impl.getGeneralBuildingBlock(); }