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(getRecordType(), "Record Type");
|
||||||
|
|
||||||
validator.checkMandatory(getNome(), "Nome");
|
validator.checkMandatory(getNome(), "Nome");
|
||||||
|
setReport(validator);
|
||||||
return validator;
|
|
||||||
|
return getReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaults() {
|
public void setDefaults() {
|
||||||
|
|
|
@ -5,11 +5,19 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
public class ValidationReport implements Serializable{
|
public class ValidationReport implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3629142756787381094L;
|
||||||
|
|
||||||
|
|
||||||
public static enum ValidationStatus{
|
public static enum ValidationStatus{
|
||||||
PASSED, ERROR, WARNING
|
PASSED, ERROR, WARNING
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,18 @@ public class SerializationTest {
|
||||||
System.out.println("Concessione is "+concessione.toString());
|
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