You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement JUnit5 integration test using below code but facing below issue
Error:
Error while parsing the document record in the collection.
com.antkorwin.commonutils.exceptions.InternalException: Error while parsing the document record in the collection.
at com.jupiter.tools.spring.test.mongo.internal.importdata.MongoDataImport.lambda$importDocumentCollection$1(MongoDataImport.java:54)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at com.jupiter.tools.spring.test.mongo.internal.importdata.MongoDataImport.importDocumentCollection(MongoDataImport.java:48)
at com.jupiter.tools.spring.test.mongo.internal.importdata.MongoDataImport.lambda$importFrom$0(MongoDataImport.java:39)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at com.jupiter.tools.spring.test.mongo.internal.importdata.MongoDataImport.importFrom(MongoDataImport.java:39)
at com.jupiter.tools.spring.test.mongo.internal.MongoDbTest.importFrom(MongoDbTest.java:59)
at com.jupiter.tools.spring.test.mongo.junit5.MongoDbExtension.beforeEach(MongoDbExtension.java:66)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachCallbacks$1(TestMethodTestDescriptor.java:159)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:195)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:195)
Caused by: java.lang.IllegalArgumentException: Unrecognized field "id" (class com.jupiter.tools.spring.test.mongo.Bar), not marked as ignorable (0 known properties: ])
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.jupiter.tools.spring.test.mongo.Bar["id"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4202)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4133)
at com.jupiter.tools.spring.test.mongo.internal.importdata.MongoDataImport.lambda$importDocumentCollection$1(MongoDataImport.java:50)
... 79 more
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "id" (class com.jupiter.tools.spring.test.mongo.Bar), not marked as ignorable (0 known properties: ])
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.jupiter.tools.spring.test.mongo.Bar["id"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:855)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1206)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1592)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1570)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:299)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4197)
... 81 more
build.gradle
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.4'
testImplementation 'org.springframework.boot:spring-boot-starter-data-mongodb:2.5.4'
testImplementation 'com.jupiter-tools:spring-test-mongo:0.15'
testImplementation 'org.projectlombok:lombok:1.18.20'
}
test {
useJUnitPlatform()
}
The text was updated successfully, but these errors were encountered:
bachhavdipak
changed the title
Getting parsing exception with Junit 5:: Caused by: java.lang.IllegalArgumentException: Unrecognized field "id" (class com.jupiter.tools.spring.test.mongo.Bar)
MongoDataImport - Error while trying to convert Object: {id=55f3ed00b1375a48e618300a, data=A} to: class com.jupiter.tools.spring.test.mongo.Bar
Sep 14, 2021
I am trying to implement JUnit5 integration test using below code but facing below issue
Error:
build.gradle
JUnit5ExampleTest.Class
Bar.Class
bar_dataset.json
The text was updated successfully, but these errors were encountered: