@Test public void overwriteJudgment_DONT_TOUCH_DB_FIELDS() { int oldId = 132; int oldVer = 12; DateTime oldCreationDate = new DateTime(2012, 12, 12, 12, 12); Whitebox.setInternalState(oldJudgment, "id", oldId); Whitebox.setInternalState(oldJudgment, "ver", oldVer); Whitebox.setInternalState(oldJudgment, "creationDate", oldCreationDate); Whitebox.setInternalState(newJudgment, "id", oldId + 10); Whitebox.setInternalState(newJudgment, "ver", oldVer + 10); Whitebox.setInternalState(newJudgment, "creationDate", oldCreationDate.plusDays(12)); judgmentOverwriter.overwriteJudgment(oldJudgment, newJudgment, correctionList); assertEquals(oldId, oldJudgment.getId()); assertEquals(oldVer, oldJudgment.getVer()); assertEquals(oldCreationDate, oldJudgment.getCreationDate()); }
@Override public final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList) { Preconditions.checkNotNull(oldJudgment); Preconditions.checkNotNull(newJudgment); overwriteCourtCases(oldJudgment, newJudgment); oldJudgment.setJudgmentDate(newJudgment.getJudgmentDate()); overwriteCourtReporters(oldJudgment, newJudgment); oldJudgment.setDecision(newJudgment.getDecision()); oldJudgment.setJudgmentType(newJudgment.getJudgmentType()); overwriteLegalBases(oldJudgment, newJudgment); oldJudgment.setSummary(newJudgment.getSummary()); overwriteJudgmentTextContent(oldJudgment.getTextContent(), newJudgment.getTextContent()); overwriteSourceInfo(oldJudgment.getSourceInfo(), newJudgment.getSourceInfo()); overwriteJudges(oldJudgment, newJudgment, correctionList); overwriteReferencedRegulations(oldJudgment, newJudgment); oldJudgment.setReceiptDate(newJudgment.getReceiptDate()); oldJudgment.setMeansOfAppeal(newJudgment.getMeansOfAppeal()); oldJudgment.setJudgmentResult(newJudgment.getJudgmentResult()); overwriteLowerCourtJudgments(oldJudgment, newJudgment); }
CommonJudgmentOverwriter implements JudgmentOverwriter<Judgment> { @Override public final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList) { Preconditions.checkNotNull(oldJudgment); Preconditions.checkNotNull(newJudgment); overwriteCourtCases(oldJudgment, newJudgment); oldJudgment.setJudgmentDate(newJudgment.getJudgmentDate()); overwriteCourtReporters(oldJudgment, newJudgment); oldJudgment.setDecision(newJudgment.getDecision()); oldJudgment.setJudgmentType(newJudgment.getJudgmentType()); overwriteLegalBases(oldJudgment, newJudgment); oldJudgment.setSummary(newJudgment.getSummary()); overwriteJudgmentTextContent(oldJudgment.getTextContent(), newJudgment.getTextContent()); overwriteSourceInfo(oldJudgment.getSourceInfo(), newJudgment.getSourceInfo()); overwriteJudges(oldJudgment, newJudgment, correctionList); overwriteReferencedRegulations(oldJudgment, newJudgment); oldJudgment.setReceiptDate(newJudgment.getReceiptDate()); oldJudgment.setMeansOfAppeal(newJudgment.getMeansOfAppeal()); oldJudgment.setJudgmentResult(newJudgment.getJudgmentResult()); overwriteLowerCourtJudgments(oldJudgment, newJudgment); } }
CommonJudgmentOverwriter implements JudgmentOverwriter<Judgment> { @Override public final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList) { Preconditions.checkNotNull(oldJudgment); Preconditions.checkNotNull(newJudgment); overwriteCourtCases(oldJudgment, newJudgment); oldJudgment.setJudgmentDate(newJudgment.getJudgmentDate()); overwriteCourtReporters(oldJudgment, newJudgment); oldJudgment.setDecision(newJudgment.getDecision()); oldJudgment.setJudgmentType(newJudgment.getJudgmentType()); overwriteLegalBases(oldJudgment, newJudgment); oldJudgment.setSummary(newJudgment.getSummary()); overwriteJudgmentTextContent(oldJudgment.getTextContent(), newJudgment.getTextContent()); overwriteSourceInfo(oldJudgment.getSourceInfo(), newJudgment.getSourceInfo()); overwriteJudges(oldJudgment, newJudgment, correctionList); overwriteReferencedRegulations(oldJudgment, newJudgment); oldJudgment.setReceiptDate(newJudgment.getReceiptDate()); oldJudgment.setMeansOfAppeal(newJudgment.getMeansOfAppeal()); oldJudgment.setJudgmentResult(newJudgment.getJudgmentResult()); overwriteLowerCourtJudgments(oldJudgment, newJudgment); }  }
CommonJudgmentOverwriter implements JudgmentOverwriter<Judgment> { @Override public final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList) { Preconditions.checkNotNull(oldJudgment); Preconditions.checkNotNull(newJudgment); overwriteCourtCases(oldJudgment, newJudgment); oldJudgment.setJudgmentDate(newJudgment.getJudgmentDate()); overwriteCourtReporters(oldJudgment, newJudgment); oldJudgment.setDecision(newJudgment.getDecision()); oldJudgment.setJudgmentType(newJudgment.getJudgmentType()); overwriteLegalBases(oldJudgment, newJudgment); oldJudgment.setSummary(newJudgment.getSummary()); overwriteJudgmentTextContent(oldJudgment.getTextContent(), newJudgment.getTextContent()); overwriteSourceInfo(oldJudgment.getSourceInfo(), newJudgment.getSourceInfo()); overwriteJudges(oldJudgment, newJudgment, correctionList); overwriteReferencedRegulations(oldJudgment, newJudgment); oldJudgment.setReceiptDate(newJudgment.getReceiptDate()); oldJudgment.setMeansOfAppeal(newJudgment.getMeansOfAppeal()); oldJudgment.setJudgmentResult(newJudgment.getJudgmentResult()); overwriteLowerCourtJudgments(oldJudgment, newJudgment); }  @Override final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList); }
CommonJudgmentOverwriter implements JudgmentOverwriter<Judgment> { @Override public final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList) { Preconditions.checkNotNull(oldJudgment); Preconditions.checkNotNull(newJudgment); overwriteCourtCases(oldJudgment, newJudgment); oldJudgment.setJudgmentDate(newJudgment.getJudgmentDate()); overwriteCourtReporters(oldJudgment, newJudgment); oldJudgment.setDecision(newJudgment.getDecision()); oldJudgment.setJudgmentType(newJudgment.getJudgmentType()); overwriteLegalBases(oldJudgment, newJudgment); oldJudgment.setSummary(newJudgment.getSummary()); overwriteJudgmentTextContent(oldJudgment.getTextContent(), newJudgment.getTextContent()); overwriteSourceInfo(oldJudgment.getSourceInfo(), newJudgment.getSourceInfo()); overwriteJudges(oldJudgment, newJudgment, correctionList); overwriteReferencedRegulations(oldJudgment, newJudgment); oldJudgment.setReceiptDate(newJudgment.getReceiptDate()); oldJudgment.setMeansOfAppeal(newJudgment.getMeansOfAppeal()); oldJudgment.setJudgmentResult(newJudgment.getJudgmentResult()); overwriteLowerCourtJudgments(oldJudgment, newJudgment); }  @Override final void overwriteJudgment(Judgment oldJudgment, Judgment newJudgment, ImportCorrectionList correctionList);  }