protected void prepareContextForVersion(SchemaVersion schemaVersion) {
        TypeContext typeContext = Mockito.spy(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);
        ObjectMapper objectMapper = new ObjectMapper();
        Mockito.when(this.context.getGeneratorConfig().getObjectMapper()).thenReturn(objectMapper);
        Mockito.when(this.context.getGeneratorConfig().createArrayNode()).thenAnswer(_invocation -> objectMapper.createArrayNode());
        Mockito.when(this.context.getGeneratorConfig().createObjectNode()).thenAnswer(_invocation -> objectMapper.createObjectNode());
        Mockito.when(this.context.getGeneratorConfig().getSchemaVersion()).thenReturn(schemaVersion);

        Answer<String> keywordLookup = invocation -> ((SchemaKeyword) invocation.getArgument(0)).forVersion(schemaVersion);
        Mockito.when(this.context.getGeneratorConfig().getKeyword(Mockito.any())).thenAnswer(keywordLookup);
        Mockito.when(this.context.getKeyword(Mockito.any())).thenAnswer(keywordLookup);
    }
Override generation context mock methods that are version dependent.

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