Refine search
@Test @SpecAssertion(section = LEGAL_BEAN_TYPES, id = "c") public void testAbstractApiType() { Set<Bean<FriendlyAntelope>> beans = getBeans(FriendlyAntelope.class); assertEquals(beans.size(), 1); Bean<FriendlyAntelope> bean = beans.iterator().next(); assertEquals(bean.getTypes().size(), 4); assertTrue(bean.getTypes().contains(FriendlyAntelope.class)); assertTrue(bean.getTypes().contains(AbstractAntelope.class)); assertTrue(bean.getTypes().contains(Animal.class)); assertTrue(bean.getTypes().contains(Object.class)); }
@Test(enabled = false) // disabled due to CDITCK-575 and marked as testable false // @SpecAssertions({ @SpecAssertion(section = RESOURCE_TYPES, id = "b") }) public void resourceBeanTypesContainsOnlyLegalTypes() { Bean<Dog> dogBean = getUniqueBean(Dog.class, Produced.ProducedLiteral.INSTANCE); for (Type type : dogBean.getTypes()) { if (type instanceof ParameterizedType) { assertNotEquals(((ParameterizedType) type).getRawType(), AnimalHolder.class); } } assertEquals(dogBean.getTypes().size(), 2); }
@Test(groups = { "producerField" }) @SpecAssertion(section = "3.4.1", id = "a") public void testApiTypeForInterfaceReturn() { Set<Bean<Animal>> animalBeans = getBeans(Animal.class, new AnnotationLiteral<AsAnimal>() {}); assert animalBeans.size() == 1; Bean<Animal> animalModel = animalBeans.iterator().next(); assert animalModel.getTypes().size() == 2; assert animalModel.getTypes().contains(Animal.class); assert animalModel.getTypes().contains(Object.class); }
@Test(groups = "producerMethod") @SpecAssertion(section = "3.3.1", id = "ba") public void testApiTypeForPrimitiveReturn() throws Exception { assert getBeans(Integer.class).size() == 1; Bean<Integer> integer = getBeans(Integer.class).iterator().next(); assert integer.getTypes().size() == 2; assert integer.getTypes().contains(int.class); assert integer.getTypes().contains(Object.class); }
@Test(groups = "producerMethod") @SpecAssertion(section = "3.3.1", id = "a") public void testApiTypeForInterfaceReturn() throws Exception { assert getBeans(Bite.class).size() == 1; Bean<Bite> animal = getBeans(Bite.class).iterator().next(); assert animal.getTypes().size() == 2; assert animal.getTypes().contains(Bite.class); assert animal.getTypes().contains(Object.class); }
@Test @SpecAssertions({ @SpecAssertion(section = RESOURCE_TYPES, id = "aa") }) public void testResourceBeanTypes() { Bean<BeanManager> beanRemote = getBeans(BeanManager.class, new AnnotationLiteral<Another>() { }).iterator().next(); assert beanRemote.getTypes().size() == 2; assert beanRemote.getTypes().contains(BeanManager.class); assert beanRemote.getTypes().contains(Object.class); } }
@Test @SpecAssertions({ @SpecAssertion(section = SESSION_BEAN_TYPES, id = "aa"), @SpecAssertion(section = DECLARING_SESSION_BEAN, id = "c") }) public void testBeanTypesAreLocalInterfacesWithoutWildcardTypesOrTypeVariablesWithSuperInterfaces() { Bean<DogLocal> dogBean = getBeans(DogLocal.class).iterator().next(); assert dogBean.getTypes().contains(DogLocal.class); assert dogBean.getTypes().contains(PitbullLocal.class); assert !dogBean.getTypes().contains(Pitbull.class); }
@Test @SpecAssertions({ @SpecAssertion(section = SESSION_BEAN_TYPES, id = "e") }) public void sessionBeanTypesContainsOnlyLegalTypes() { Bean<Bird> birdBean = getUniqueBean(Bird.class); for (Type type : birdBean.getTypes()) { if (type instanceof ParameterizedType) { assertNotEquals(((ParameterizedType) type).getRawType(), AnimalHolder.class); } } assertEquals(birdBean.getTypes().size(), 2); }
@Test @SpecAssertion(section = PERFORMING_TYPESAFE_RESOLUTION, id = "lb") public void testDefaultBindingTypeAssumed() throws Exception { Set<Bean<Tuna>> possibleTargets = getBeans(Tuna.class); assertEquals(possibleTargets.size(), 1); assertTrue(possibleTargets.iterator().next().getTypes().contains(Tuna.class)); }
@Test(groups = INTEGRATION) @SpecAssertion(section = SESSION_BEAN_TYPES, id = "ba") public void testSessionBeanWithNoInterfaceView(){ Bean<Cobra> cobraBean = getUniqueBean(Cobra.class); assertNotNull(cobraBean); assertEquals(cobraBean.getTypes().size(), 3); assertTypeSetMatches(cobraBean.getTypes(), Object.class, Cobra.class, Snake.class); } }
@Test(groups = "resolution") @SpecAssertion(section = "5.2", id = "lb") public void testDefaultBindingTypeAssumed() throws Exception { Set<Bean<Tuna>> possibleTargets = getBeans(Tuna.class); assert possibleTargets.size() == 1; assert possibleTargets.iterator().next().getTypes().contains(Tuna.class); }
@Test @SpecAssertion(section = ALTERNATIVE_METADATA_SOURCES, id = "kd") public void testGetTypeClosureUsedToDetermineTypeOfProducerMethod() { // produced by Grocery.createVegetable() Bean<Carrot> carrot = getBeans(Carrot.class, new CheapLiteral()).iterator().next(); // should be [Object, Carrot] instead of [Object, Carrot, Vegetables] assertEquals(carrot.getTypes().size(), 2); assertFalse(carrot.getTypes().contains(Vegetables.class)); assertTrue(GroceryWrapper.isGetTypeClosureOfProducerMethodUsed()); }
@Test(groups = { "ejb 3.1" }) @SpecAssertion(section = "3.2.2", id = "ba") public void testEnterpriseBeanClassLocalView() { //TODO We need a 3.1 compliant container for this test Bean<Retriever> dogBean = getBeans(Retriever.class).iterator().next(); assert dogBean.getTypes().contains(Retriever.class); }
@Test(groups = { "enterpriseBeans", "ejbjarxml" }) @SpecAssertions( { @SpecAssertion(section = "3.1.1", id = "n"), @SpecAssertion(section = "3.2.2", id = "ba") }) public void testEjbDeclaredInXmlNotSimpleBean() { Bean<ElephantLocal> elephantBean = getBeans(ElephantLocal.class).iterator().next(); // The interface is a known type but the class should not be assert elephantBean.getTypes().contains(ElephantLocal.class); assert !elephantBean.getTypes().contains(Elephant.class); }
@Test @SpecAssertions({ @SpecAssertion(section = PERFORMING_TYPESAFE_RESOLUTION, id = "ka") }) public void testResolveByTypeWithTypeParameter() throws Exception { Set<Bean<Farmer<ScottishFish>>> beans = getBeans(new TypeLiteral<Farmer<ScottishFish>>() { }); assertEquals(beans.size(), 1); assertTrue(beans.iterator().next().getTypes().contains(ScottishFishFarmer.class)); }
@Test(groups = JAVAEE_FULL) @SpecAssertions({ @SpecAssertion(section = RESOURCE_TYPES, id = "ad") }) public void testResourceBeanTypes() { @SuppressWarnings("serial") Bean<BeanRemote> beanRemote = getBeans(BeanRemote.class, new AnnotationLiteral<Lazy>() { }).iterator().next(); assert beanRemote.getTypes().size() == 3; assert typeSetMatches(beanRemote.getTypes(), BeanRemote.class, Object.class, AnotherInterface.class); }
@Test @SpecAssertions({ @SpecAssertion(section = RESOURCE_TYPES, id = "aa") }) public void testResourceBeanTypes() { @SuppressWarnings("serial") Bean<String> greeting = getBeans(String.class, new AnnotationLiteral<Greeting>() { }).iterator().next(); assert greeting.getTypes().size() == 5; assert rawTypeSetMatches(greeting.getTypes(), String.class, Object.class, Serializable.class, Comparable.class, CharSequence.class); } }
@Test @SpecAssertions({ @SpecAssertion(section = RESOURCE_TYPES, id = "ac") }) public void testBeanTypesOfPersistenceUnit() { Bean<EntityManagerFactory> factory = getBeans(EntityManagerFactory.class, new AnnotationLiteral<Database>() { }).iterator().next(); assert factory.getTypes().size() == 2; assert typeSetMatches(factory.getTypes(), EntityManagerFactory.class, Object.class); } }