Serialization tests
This commit is contained in:
parent
f68290afa5
commit
f30c662e35
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue