|
1 | 1 | package org.evomaster.e2etests.spring.openapi.v3.dtoreflectiveassert |
2 | 2 |
|
3 | 3 | import com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert.DtoReflectiveAssertController |
4 | | -import org.evomaster.client.java.instrumentation.shared.ClassName |
5 | 4 | import org.evomaster.core.problem.rest.data.HttpVerb |
6 | 5 | import org.evomaster.e2etests.spring.openapi.v3.SpringTestBase |
7 | 6 | import org.junit.jupiter.api.Assertions |
8 | 7 | import org.junit.jupiter.api.BeforeAll |
9 | 8 | import org.junit.jupiter.api.Test |
10 | | -import java.util.Optional.ofNullable |
11 | 9 | import kotlin.reflect.KClass |
12 | | -import kotlin.reflect.KMutableProperty1 |
13 | | -import kotlin.reflect.full.createInstance |
14 | 10 | import kotlin.reflect.full.memberFunctions |
15 | | -import kotlin.reflect.full.memberProperties |
16 | 11 | import kotlin.reflect.jvm.isAccessible |
17 | 12 | import kotlin.reflect.jvm.javaMethod |
18 | 13 |
|
@@ -161,25 +156,6 @@ class DtoReflectiveAssertEMTest: SpringTestBase() { |
161 | 156 | assertAdditionalPropertiesFunction(parentKlass, parentInstance, "no_root_key", childInstance) |
162 | 157 | } |
163 | 158 |
|
164 | | - private fun initDtoClass(name: String): Pair<KClass<out Any>, Any> { |
165 | | - val className = ClassName("org.foo.dto.$name") |
166 | | - val klass = loadClass(className).kotlin |
167 | | - Assertions.assertNotNull(klass) |
168 | | - return Pair(klass, klass.createInstance()) |
169 | | - } |
170 | | - |
171 | | - private fun assertProperty(klass: KClass<out Any>, instance: Any, propertyName: String, propertyValue: Any?) { |
172 | | - val property = klass.memberProperties |
173 | | - .firstOrNull { it.name == propertyName } as? KMutableProperty1<Any, Any?> |
174 | | - Assertions.assertNotNull(property) |
175 | | - |
176 | | - property?.let { |
177 | | - it.isAccessible = true |
178 | | - it.set(instance, ofNullable(propertyValue)) // Set the value |
179 | | - } |
180 | | - Assertions.assertEquals(ofNullable(propertyValue), property?.get(instance)) |
181 | | - } |
182 | | - |
183 | 159 | private fun assertAdditionalPropertiesFunction(klass: KClass<out Any>, instance: Any, propertyName: String, propertyValue: Any?) { |
184 | 160 | val setterFunction = klass.memberFunctions.firstOrNull { |
185 | 161 | it.name == "addAdditionalProperty" |
|
0 commit comments