Esempio n. 1
0
  private Enhancer createEnhancer(Class<?> toMock) {
    // Create the mock
    Enhancer enhancer =
        new Enhancer() {

          /** Filter all private constructors but do not check that there are some left */
          @SuppressWarnings("rawtypes")
          @Override
          protected void filterConstructors(Class sc, List constructors) {
            CollectionUtils.filter(constructors, new VisibilityPredicate(sc, true));
          }
        };
    enhancer.setSuperclass(toMock);

    // ///CLOVER:OFF (I don't know how to test it automatically yet)
    // See issue ID: 2994002
    if (toMock.getSigners() != null) {
      enhancer.setNamingPolicy(ALLOWS_MOCKING_CLASSES_IN_SIGNED_PACKAGES);
    }
    // ///CLOVER:ON

    return enhancer;
  }