### Question:
BlueprintStateServiceImpl implements BlueprintStateService, BlueprintListener { @Override public Throwable getBundleFailureCause( long bundleId ) { BlueprintEvent blueprintEvent = states.get( bundleId ); if ( blueprintEvent == null ) { return null; } return blueprintEvent.getCause(); } BlueprintStateServiceImpl( BundleContext bundleContext ); @Override Boolean isBlueprintLoaded( long bundleId ); @Override Boolean isBlueprintFailed( long bundleId ); @Override Boolean isBlueprintTryingToLoad( long bundleId ); @Override Boolean hasBlueprint( long bundleId ); @Override void blueprintEvent( BlueprintEvent blueprintEvent ); @Override BundleState getBundleState( long bundleId ); @Override String[] getBundleMissDependencies( long bundleId ); @Override Throwable getBundleFailureCause( long bundleId );  }### Answer:
@Test public void testBundleFailureCause() { Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_UNKNOWN_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_STARTING_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_ACTIVE_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_STOPPING_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_RESOLVED_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_FAILURE_ID ), MOCK_BUNDLE_FAILED_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_GRACE_PERIOD_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_WAITING_ID ), MOCK_BUNDLE_NO_CAUSE ); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_NO_BLUEPRINT_ID ), MOCK_BUNDLE_NO_CAUSE ); bundleGracePeriodToFailed(); Assert.assertEquals( blueprintStateServiceImpl.getBundleFailureCause( MOCK_BUNDLE_GRACE_PERIOD_ID ), MOCK_BUNDLE_FAILED_CAUSE ); }