Search in sources :

Example 46 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class RequestContextAsyncListenerTest method testRequestContextActiveOnError.

@Test(groups = { INTEGRATION, ASYNC_SERVLET })
@SpecAssertion(section = REQUEST_CONTEXT_EE, id = "ad")
public void testRequestContextActiveOnError() throws Exception {
    WebClient webClient = new WebClient();
    webClient.getPage(getPath(AsyncServlet.TEST_ERROR));
    TextPage results = webClient.getPage(contextPath + "Status");
    assertTrue(results.getContent().contains("onError: true"));
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 47 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class RequestContextAsyncListenerTest method testRequestContextActiveOnStartAsync.

@Test(groups = { INTEGRATION, ASYNC_SERVLET })
@SpecAssertion(section = REQUEST_CONTEXT_EE, id = "ad")
public void testRequestContextActiveOnStartAsync() throws Exception {
    WebClient webClient = new WebClient();
    webClient.getPage(getPath(AsyncServlet.TEST_LOOP));
    TextPage results = webClient.getPage(contextPath + "Status");
    assertTrue(results.getContent().contains("onStartAsync: true"));
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 48 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class RequestContextTest method testRequestScopeActiveDuringServiceMethod.

/**
 * The request scope is active during the service() method of any Servlet in the web application.
 */
@Test
@SpecAssertion(section = REQUEST_CONTEXT_EE, id = "aa")
@SpecAssertion(section = REQUEST_CONTEXT_EE, id = "ac")
public void testRequestScopeActiveDuringServiceMethod() throws Exception {
    WebClient webClient = new WebClient();
    webClient.getPage(contextPath + "test");
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 49 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class DestroyedInstanceReturnedByGetTest method testDestroyedInstanceMustNotBeReturnedByGet.

@Test(groups = TestGroups.CDI_FULL)
@SpecAssertion(section = CONTEXT, id = "q")
@SpecAssertion(section = BEAN, id = "aa")
public void testDestroyedInstanceMustNotBeReturnedByGet() {
    assert getBeans(MySessionBean.class).size() == 1;
    Bean<MySessionBean> mySessionBean = getBeans(MySessionBean.class).iterator().next();
    CreationalContext<MySessionBean> sessionCreationalContext = getCurrentManager().createCreationalContext(mySessionBean);
    MySessionBean beanInstance = mySessionBean.create(sessionCreationalContext);
    assert beanInstance != null;
    Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
    destroyContext(sessionContext);
    setContextActive(sessionContext);
    beanInstance = sessionContext.get(mySessionBean);
    assert beanInstance == null;
}
Also used : Context(jakarta.enterprise.context.spi.Context) CreationalContext(jakarta.enterprise.context.spi.CreationalContext) AbstractTest(org.jboss.cdi.tck.AbstractTest) Test(org.testng.annotations.Test) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Example 50 with SpecAssertion

use of org.jboss.test.audit.annotations.SpecAssertion in project cdi-tck by eclipse-ee4j.

the class DecoratorDefinitionTest method testEmptyTypeSetOnResolveDecoratorsFails.

@Test(expectedExceptions = IllegalArgumentException.class)
@SpecAssertion(section = BM_DECORATOR_RESOLUTION, id = "e")
public void testEmptyTypeSetOnResolveDecoratorsFails() {
    Annotation binding = new AnnotationLiteral<NonMeta>() {
    };
    getCurrentManager().resolveDecorators(new HashSet<Type>(), binding);
}
Also used : Type(java.lang.reflect.Type) AnnotationLiteral(jakarta.enterprise.util.AnnotationLiteral) Annotation(java.lang.annotation.Annotation) Test(org.testng.annotations.Test) AbstractTest(org.jboss.cdi.tck.AbstractTest) SpecAssertion(org.jboss.test.audit.annotations.SpecAssertion)

Aggregations

SpecAssertion (org.jboss.test.audit.annotations.SpecAssertion)943 Test (org.testng.annotations.Test)893 AbstractTCKTest (org.hibernate.beanvalidation.tck.tests.AbstractTCKTest)595 ConstraintViolation (jakarta.validation.ConstraintViolation)265 Validator (jakarta.validation.Validator)216 AbstractTest (org.jboss.cdi.tck.AbstractTest)212 WebClient (com.gargoylesoftware.htmlunit.WebClient)190 Method (java.lang.reflect.Method)152 TextPage (com.gargoylesoftware.htmlunit.TextPage)80 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)73 Test (org.junit.Test)49 MethodDescriptor (jakarta.validation.metadata.MethodDescriptor)44 BeanDescriptor (jakarta.validation.metadata.BeanDescriptor)40 ConstructorDescriptor (jakarta.validation.metadata.ConstructorDescriptor)38 NotNull (jakarta.validation.constraints.NotNull)35 ValidatorFactory (jakarta.validation.ValidatorFactory)32 PropertyDescriptor (jakarta.validation.metadata.PropertyDescriptor)31 Context (jakarta.enterprise.context.spi.Context)30 SeContainer (jakarta.enterprise.inject.se.SeContainer)30 WebResponse (com.gargoylesoftware.htmlunit.WebResponse)28