// Path: jmock-imposters-tests/src/test/java/org/jmock/test/unit/lib/legacy/ImposteriserParameterResolver.java
// public class ImposteriserParameterResolver extends AbstractImposteriserParameterResolver {
// 
//     public ImposteriserParameterResolver() {
//         super(ByteBuddyClassImposteriser.INSTANCE,
//                 ClassImposteriser.INSTANCE,
//                 JavaReflectionImposteriser.INSTANCE);
//     }
// 
// }


import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.ref.WeakReference;
import org.jmock.Mockery;
import org.jmock.api.Imposteriser;
import org.jmock.lib.concurrent.Synchroniser;
import org.jmock.test.unit.lib.legacy.CodeGeneratingImposteriserParameterResolver;
import org.jmock.test.unit.lib.legacy.ImposteriserParameterResolver;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
    @ParameterizedTest
    @ArgumentsSource(ImposteriserParameterResolver.class)
    public void mockedInterfaceDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);
        
        checkNoFinalizationMessage(mockery, CharSequence.class);
    }

    @ParameterizedTest
    @ArgumentsSource(CodeGeneratingImposteriserParameterResolver.class)
    public void mockedClassDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);

        checkNoFinalizationMessage(mockery, Object.class);
    }

    public interface TypeThatMakesFinalizePublic {
        public void finalize();
    }

    @ParameterizedTest
    @ArgumentsSource(ImposteriserParameterResolver.class)
    public void mockedTypeThatMakesFinalizePublicDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);

        checkNoFinalizationMessage(mockery, TypeThatMakesFinalizePublic.class);
    }

    private void checkNoFinalizationMessage(Mockery mockery, Class<?> typeToMock) {
        WeakReference<Object> mockHolder = new WeakReference<Object>(mockery.mock(typeToMock));
// Path: jmock-imposters-tests/src/test/java/org/jmock/test/unit/lib/legacy/ImposteriserParameterResolver.java
// public class ImposteriserParameterResolver extends AbstractImposteriserParameterResolver {
// 
//     public ImposteriserParameterResolver() {
//         super(ByteBuddyClassImposteriser.INSTANCE,
//                 ClassImposteriser.INSTANCE,
//                 JavaReflectionImposteriser.INSTANCE);
//     }
// 
// }


// Path: jmock-imposters-tests/src/test/java/org/jmock/test/acceptance/MockeryFinalizationAcceptanceTests.java
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.ref.WeakReference;
import org.jmock.Mockery;
import org.jmock.api.Imposteriser;
import org.jmock.lib.concurrent.Synchroniser;
import org.jmock.test.unit.lib.legacy.CodeGeneratingImposteriserParameterResolver;
import org.jmock.test.unit.lib.legacy.ImposteriserParameterResolver;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;

    @ParameterizedTest
    @ArgumentsSource(ImposteriserParameterResolver.class)
    public void mockedInterfaceDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);
        
        checkNoFinalizationMessage(mockery, CharSequence.class);
    }

    @ParameterizedTest
    @ArgumentsSource(CodeGeneratingImposteriserParameterResolver.class)
    public void mockedClassDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);

        checkNoFinalizationMessage(mockery, Object.class);
    }

    public interface TypeThatMakesFinalizePublic {
        public void finalize();
    }

    @ParameterizedTest
    @ArgumentsSource(ImposteriserParameterResolver.class)
    public void mockedTypeThatMakesFinalizePublicDoesntWarnOnFinalize(Imposteriser imposterImpl) {
        mockery.setImposteriser(imposterImpl);

        checkNoFinalizationMessage(mockery, TypeThatMakesFinalizePublic.class);
    }

    private void checkNoFinalizationMessage(Mockery mockery, Class<?> typeToMock) {
        WeakReference<Object> mockHolder = new WeakReference<Object>(mockery.mock(typeToMock));
        while (mockHolder.get() != null) {