I have a problem and below is code:-
MainService.java
public void someMethod(Message message){
A aObj = new A (someEnumClass.enumValue, message)
someService.saveData(aObj)
}
public Class A extends B {
int x,y,z;
A(SomeEnumClass enumValue,int c){
super(enumValue);
}
Public abstract class B<EnumClass extends Enum<EnumClass>>{
private EnumClass enumValue
}
Now the above code works:
But when I test using my below class
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class MyDemoTests {
@Autowired
private SomeService someService;
@Autowired
private someRepo repository;
@Test
public void testMyservice() throws Exception {
List<A> results = repository.findAll();
assertThat(results).containsAll(all);
}
I get the below error on "results":-
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `java.lang.Enum` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: (InputStreamReader); line: 1, column: 123] (through reference chain: com.example.A["enumValue"])
Much Appreciated. Thanks
opr? What issaved1? What doessaved1.getI()return? How can anyone be expected to answer this question?