I have a plain implementation of "LinearState" where the only parameter is a UniqueIdentifier. I have a simple Contract to go with it.
When I try to put it through unit testing, however, I keep getting "NotSerializabeException".
I'm using the Corda v4 java template. Testing setup with Gradle Runner on IntelliJ.
I've tried annotating the class with @CordaSerializable, and the constructor with @ConstructorForDeserialization
@CordaSerializable
public class InvestorState implements LinearState {
private final UniqueIdentifier linearId;
@ConstructorForDeserialization
public InvestorState(UniqueIdentifier id) {
this.linearId = id;
}
...
}
Error log: data(net.corda.core.contracts.ContractState) -> Trying to build an object serializer for com.mycordapp.states.InvestorState, but it is not constructible from its public properties, and so requires a custom serialiser. java.io.NotSerializableException: data(net.corda.core.contracts.ContractState) -> Trying to build an object serializer for com.mycordapp.states.InvestorState, but it is not constructible from its public properties, and so requires a custom serialiser. at net.corda.serialization.internal.amqp.ObjectSerializer$Companion.make(ObjectSerializer.kt:18) at net.corda.serialization.internal.amqp.DefaultLocalSerializerFactory.makeNonCustomSerializer(LocalSerializerFactory.kt:240) ...