### Question:
BlueprintFactory { protected Stack createStack(Map<String, Object> properties) throws NoSuchStackException { String stackName = String.valueOf(properties.get(STACK_NAME_PROPERTY_ID)); String stackVersion = String.valueOf(properties.get(STACK_VERSION_PROPERTY_ID)); try { return stackFactory.createStack(stackName, stackVersion, AmbariServer.getController()); } catch (ObjectNotFoundException e) { throw new NoSuchStackException(stackName, stackVersion); } catch (AmbariException e) { throw new RuntimeException("An error occurred parsing the stack information.", e); } } BlueprintFactory(); protected  BlueprintFactory(StackFactory stackFactory); Blueprint getBlueprint(String blueprintName); @SuppressWarnings("unchecked") Blueprint createBlueprint(Map<String, Object> properties, SecurityConfiguration securityConfiguration); @Inject static void init(BlueprintDAO dao);  }### Answer:
@Test(expected=NoSuchStackException.class) public void testCreateInvalidStack() throws Exception { EasyMockSupport mockSupport = new EasyMockSupport(); BlueprintFactory.StackFactory mockStackFactory = mockSupport.createMock(BlueprintFactory.StackFactory.class); expect(mockStackFactory.createStack("null", "null", null)).andThrow(new ObjectNotFoundException("Invalid Stack")); mockSupport.replayAll(); BlueprintFactory factoryUnderTest = new BlueprintFactory(mockStackFactory); factoryUnderTest.createStack(new HashMap<>()); mockSupport.verifyAll(); }