### Question:
ClusterScopeContext implements Context { static <TT> String getBeanName(Bean<TT> bean, Clustered annotation) { try { return firstNonNull(annotation.keyName(), bean.getName(), bean.getBeanClass().getName()); } catch (Throwable t) { throw new IllegalArgumentException("Could not find the name for bean: " + bean.toString(), t); } } ClusterScopeContext(BeanManager beanManager, Deployment deployment); @Override Class<? extends Annotation> getScope(); @Override TT get(Contextual<TT> contextual, CreationalContext<TT> creationalContext); @Override @SuppressWarnings("unchecked") TT get(Contextual<TT> contextual); @Override boolean isActive();  }### Answer:
@Test public void when_key_name_not_empty_expect_correct_getBeanName() { assertEquals(ANNOTATION_BEAN_NAME, ClusterScopeContext.getBeanName(bean, annotation)); }
@Test public void when_key_name_null_expect_correct_getBeanName() { when(annotation.keyName()).thenReturn(null); assertEquals(CDI_BEAN_NAME, ClusterScopeContext.getBeanName(bean, annotation)); }
@Test public void when_key_name_empty_expect_correct_getBeanName() { when(annotation.keyName()).thenReturn(""); assertEquals(CDI_BEAN_NAME, ClusterScopeContext.getBeanName(bean, annotation)); }
@Test public void when_key_name_blank_expect_correct_getBeanName() { when(annotation.keyName()).thenReturn(" "); assertEquals(CDI_BEAN_NAME, ClusterScopeContext.getBeanName(bean, annotation)); }
@Test public void when_key_name_and_bean_name_null_expect_correct_getBeanName() { when(annotation.keyName()).thenReturn(null); when(bean.getName()).thenReturn(null); assertEquals("java.lang.Object", ClusterScopeContext.getBeanName(bean, annotation)); }