Serialization tests

This commit is contained in:
Fabio Sinibaldi 2020-12-22 17:49:15 +01:00
parent f68290afa5
commit f30c662e35
3 changed files with 25 additions and 2 deletions

View File

@ -51,8 +51,9 @@ public abstract class Record {
validator.checkMandatory(getRecordType(), "Record Type");
validator.checkMandatory(getNome(), "Nome");
return validator;
setReport(validator);
return getReport();
}
public void setDefaults() {

View File

@ -5,11 +5,19 @@ import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class ValidationReport implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3629142756787381094L;
public static enum ValidationStatus{
PASSED, ERROR, WARNING
}

View File

@ -48,4 +48,18 @@ public class SerializationTest {
System.out.println("Concessione is "+concessione.toString());
}
@Test
public void generic() throws JsonProcessingException, IOException {
Concessione conc=TestModel.prepareConcessione();
conc.validate();
full(conc);
}
public void full(Object obj) throws JsonProcessingException, IOException {
String asString=mapper.writeValueAsString(obj);
Object other=mapper.readerFor(obj.getClass()).readValue(asString);
}
}