You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/04/07 18:10:24 UTC

(grails-core) 27/33: test(h7): add GrailsBytecodeProvider spec and expand proxy factory coverage

This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 24d5e1c04a636c1e03b7bf467a6bbe8d88343367
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Apr 7 11:58:19 2026 -0500

    test(h7): add GrailsBytecodeProvider spec and expand proxy factory coverage
    
    - Create GrailsBytecodeProviderSpec covering: instantiation, proxyHelper,
      getProxyFactoryFactory, getReflectionOptimizer (both overloads),
      getEnhancer, and buildBasicProxyFactory
    - Mark X: GrailsBytecodeProvider, GrailsProxyFactoryFactory in JACOCO_COVERAGE_VIOLATIONS.md
    
    Co-authored-by: Copilot <22...@users.noreply.github.com>
---
 .../proxy/GrailsBytecodeProviderSpec.groovy        | 69 ++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/proxy/GrailsBytecodeProviderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/proxy/GrailsBytecodeProviderSpec.groovy
new file mode 100644
index 0000000000..f419922444
--- /dev/null
+++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/proxy/GrailsBytecodeProviderSpec.groovy
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.orm.hibernate.proxy
+
+import org.hibernate.bytecode.enhance.spi.EnhancementContext
+import spock.lang.Specification
+import spock.lang.Subject
+
+class GrailsBytecodeProviderSpec extends Specification {
+
+    @Subject
+    GrailsBytecodeProvider provider = new GrailsBytecodeProvider()
+
+    def "provider can be instantiated and returns non-null proxyHelper"() {
+        expect:
+        provider != null
+        provider.proxyHelper != null
+    }
+
+    def "getProxyFactoryFactory returns GrailsProxyFactoryFactory"() {
+        expect:
+        provider.getProxyFactoryFactory() instanceof GrailsProxyFactoryFactory
+    }
+
+    def "getReflectionOptimizer with getter/setter names returns null"() {
+        expect:
+        provider.getReflectionOptimizer(String, ["getName"] as String[], ["setName"] as String[], [String] as Class[]) == null
+    }
+
+    def "getReflectionOptimizer with propertyAccessMap returns null"() {
+        expect:
+        provider.getReflectionOptimizer(String, [:]) == null
+    }
+
+    def "getEnhancer returns null"() {
+        given:
+        def context = Mock(EnhancementContext)
+
+        expect:
+        provider.getEnhancer(context) == null
+    }
+
+    def "getProxyFactoryFactory can build proxy factory and basic proxy factory"() {
+        given:
+        def factory = provider.getProxyFactoryFactory() as GrailsProxyFactoryFactory
+
+        when:
+        def basicProxy = factory.buildBasicProxyFactory(String)
+
+        then:
+        basicProxy == null
+    }
+}