code: @Override
     protected Statement withAfters(final FrameworkMethod method, final Object target, final Statement statement)
     {
        final Statement afters = super.withAfters(method, target, new NoopStatement());
        return new Statement() 
        {
           @Override
           public void evaluate() throws Throwable
           {
              statement.evaluate();
              afters.evaluate();
  
              TestClass tc = getTestClass();
              
              // Non-static @Resource
              List<FrameworkField> fields = tc.getAnnotatedFields(Resource.class);
              if (fields != null && !fields.isEmpty())
              {
                 for (FrameworkField f : fields)
                 {
                    SecurityActions.setAccessible(f.getField());
                    if (!Modifier.isStatic(f.getField().getModifiers()) && !f.getField().getDeclaringClass().isPrimitive())
                    {
                       f.getField().set(target, null);
                    }
                 }
              }
  
              // Non-static @Inject / @Named
              fields = tc.getAnnotatedFields(javax.inject.Inject.class);
              if (fields != null && !fields.isEmpty())
              {
                 for (FrameworkField f : fields)
                 {
                    SecurityActions.setAccessible(f.getField());
                    if (!Modifier.isStatic(f.getField().getModifiers()) && !f.getField().getDeclaringClass().isPrimitive())
                    {
                       f.getField().set(target, null);
                    }
                 }
              }
  
              // Non-static @Deployment
              if (!deployments.isEmpty())
              {
                 for (int i = deployments.size() - 1; i >= 0; i--)
                 {
                    Object deployment = deployments.get(i);
                    if (deployment instanceof URL)
                    {
                       embedded.undeploy((URL)deployment);
                    }
                    else if (deployment instanceof ResourceAdapterArchive)
                    {
                       embedded.undeploy((ResourceAdapterArchive)deployment);
                    }
                    else if (deployment instanceof Descriptor)
                    {
                       embedded.undeploy((Descriptor)deployment);
                    }
                 }
              }
              deployments.clear();
           }
        };
     }
docs: {@inheritDoc}