protected void prepareContextForVersion(SchemaVersion schemaVersion) {
        TypeContext typeContext = TypeContextFactory.createDefaultTypeContext(Mockito.mock(SchemaGeneratorConfig.class));
        ResolvedType resolvedTestClass = typeContext.resolve(this.testClass);
        this.declarationDetails = new MemberScope.DeclarationDetails(resolvedTestClass, typeContext.resolveWithMembers(resolvedTestClass));
        this.context = Mockito.mock(SchemaGenerationContext.class, Mockito.RETURNS_DEEP_STUBS);
        Mockito.when(this.context.getTypeContext()).thenReturn(typeContext);

        SchemaGeneratorConfig config = Mockito.mock(SchemaGeneratorConfig.class);
        Mockito.when(this.context.getGeneratorConfig()).thenReturn(config);
        Mockito.when(config.resolveArrayMaxItems(Mockito.any(FieldScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayMaxItems(Mockito.any(MethodScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayMaxItemsForType(Mockito.any())).thenReturn(null);
        Mockito.when(config.resolveArrayMinItems(Mockito.any(FieldScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayMinItems(Mockito.any(MethodScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayMinItemsForType(Mockito.any())).thenReturn(null);
        Mockito.when(config.resolveArrayUniqueItems(Mockito.any(FieldScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayUniqueItems(Mockito.any(MethodScope.class))).thenReturn(null);
        Mockito.when(config.resolveArrayUniqueItemsForType(Mockito.any())).thenReturn(null);
        Mockito.when(config.resolveStringMaxLength(Mockito.any(FieldScope.class))).thenReturn(null);
        Mockito.when(config.resolveStringMaxLength(Mockito.any(MethodScope.class))).thenReturn(null);
        Mockito.when(config.resolveStringMaxLengthForType(Mockito.any())).thenReturn(null);
        Mockito.when(config.resolveStringMinLength(Mockito.any(FieldScope.class))).thenReturn(null);
        Mockito.when(config.resolveStringMinLength(Mockito.any(MethodScope.class))).thenReturn(null);
        Mockito.when(config.resolveStringMinLengthForType(Mockito.any())).thenReturn(null);

        Mockito.when(config.getSchemaVersion()).thenReturn(schemaVersion);
        Answer<String> keywordLookup = invocation -> ((SchemaKeyword) invocation.getArgument(0)).forVersion(schemaVersion);
        Mockito.when(config.getKeyword(Mockito.any())).thenAnswer(keywordLookup);
        Mockito.when(this.context.getKeyword(Mockito.any())).thenAnswer(keywordLookup);

        ObjectMapper objectMapper = new ObjectMapper();
        Mockito.when(config.getObjectMapper()).thenReturn(objectMapper);
        Mockito.when(config.createArrayNode()).thenAnswer((_invocation) -> objectMapper.createArrayNode());
        Mockito.when(config.createObjectNode()).thenAnswer((_invocation) -> objectMapper.createObjectNode());
        Mockito.when(this.context.createStandardDefinitionReference(Mockito.any(ResolvedType.class), Mockito.any()))
                .thenAnswer((_invocation) -> objectMapper.createObjectNode());
    }
Override generation context mock methods that are version dependent.

@param schemaVersion designated JSON Schema version
jsonschema-module-jackson/src/test/java/com/github/victools/jsonschema/module/jackson/AbstractTypeAwareTest.java