@Test public void failTooSmall() { PatentApplication patent = new PatentApplication(new DocumentId(CountryCode.US, "99999"), PatentType.UTILITY); Abstract abst = new Abstract("", new DummyFormattedText()); patent.setAbstract(abst); assertFalse(abstractRule.test(patent)); }
@Override public boolean test(Patent patent) { PatentDocFormat docFormat = PatentDocFormatDetect.fromPatent(patent); if (!PatentType.DESIGN.equals(patent.getPatentType())) { StringTokenizer tokenizer = tokenize(patent.getAbstract().getPlainText()); int tokens = tokenizer.countTokens(); if (patent.getAbstract() == null || patent.getAbstract().getPlainText().length() < 10) { MESSAGE = MESSAGE + " BELOW MINIMUM SIZE: 10; " + patent.getAbstract().getPlainText(); return false; } else if ((PatentDocFormat.RedbookGrant.equals(docFormat) || PatentDocFormat.RedbookApplication.equals(docFormat)) && tokens > 150) { MESSAGE = MESSAGE + " REDBOOK XML : ABOVE MAX WORD SIZE: 150; " + patent.getAbstract().getPlainText(); return false; } else if (tokens > 500) { MESSAGE = MESSAGE + " ABOVE MAX WORD SIZE: 500; " + patent.getAbstract().getPlainText(); return false; } } return true; }
AbstractRule implements Validator<Patent> { @Override public boolean test(Patent patent) { PatentDocFormat docFormat = PatentDocFormatDetect.fromPatent(patent); if (!PatentType.DESIGN.equals(patent.getPatentType())) { StringTokenizer tokenizer = tokenize(patent.getAbstract().getPlainText()); int tokens = tokenizer.countTokens(); if (patent.getAbstract() == null || patent.getAbstract().getPlainText().length() < 10) { MESSAGE = MESSAGE + " BELOW MINIMUM SIZE: 10; " + patent.getAbstract().getPlainText(); return false; } else if ((PatentDocFormat.RedbookGrant.equals(docFormat) || PatentDocFormat.RedbookApplication.equals(docFormat)) && tokens > 150) { MESSAGE = MESSAGE + " REDBOOK XML : ABOVE MAX WORD SIZE: 150; " + patent.getAbstract().getPlainText(); return false; } else if (tokens > 500) { MESSAGE = MESSAGE + " ABOVE MAX WORD SIZE: 500; " + patent.getAbstract().getPlainText(); return false; } } return true; } }
AbstractRule implements Validator<Patent> { @Override public boolean test(Patent patent) { PatentDocFormat docFormat = PatentDocFormatDetect.fromPatent(patent); if (!PatentType.DESIGN.equals(patent.getPatentType())) { StringTokenizer tokenizer = tokenize(patent.getAbstract().getPlainText()); int tokens = tokenizer.countTokens(); if (patent.getAbstract() == null || patent.getAbstract().getPlainText().length() < 10) { MESSAGE = MESSAGE + " BELOW MINIMUM SIZE: 10; " + patent.getAbstract().getPlainText(); return false; } else if ((PatentDocFormat.RedbookGrant.equals(docFormat) || PatentDocFormat.RedbookApplication.equals(docFormat)) && tokens > 150) { MESSAGE = MESSAGE + " REDBOOK XML : ABOVE MAX WORD SIZE: 150; " + patent.getAbstract().getPlainText(); return false; } else if (tokens > 500) { MESSAGE = MESSAGE + " ABOVE MAX WORD SIZE: 500; " + patent.getAbstract().getPlainText(); return false; } } return true; }  }
AbstractRule implements Validator<Patent> { @Override public boolean test(Patent patent) { PatentDocFormat docFormat = PatentDocFormatDetect.fromPatent(patent); if (!PatentType.DESIGN.equals(patent.getPatentType())) { StringTokenizer tokenizer = tokenize(patent.getAbstract().getPlainText()); int tokens = tokenizer.countTokens(); if (patent.getAbstract() == null || patent.getAbstract().getPlainText().length() < 10) { MESSAGE = MESSAGE + " BELOW MINIMUM SIZE: 10; " + patent.getAbstract().getPlainText(); return false; } else if ((PatentDocFormat.RedbookGrant.equals(docFormat) || PatentDocFormat.RedbookApplication.equals(docFormat)) && tokens > 150) { MESSAGE = MESSAGE + " REDBOOK XML : ABOVE MAX WORD SIZE: 150; " + patent.getAbstract().getPlainText(); return false; } else if (tokens > 500) { MESSAGE = MESSAGE + " ABOVE MAX WORD SIZE: 500; " + patent.getAbstract().getPlainText(); return false; } } return true; }  @Override boolean test(Patent patent); @Override String getName(); @Override String getMessage(); StringTokenizer tokenize(String text); }
AbstractRule implements Validator<Patent> { @Override public boolean test(Patent patent) { PatentDocFormat docFormat = PatentDocFormatDetect.fromPatent(patent); if (!PatentType.DESIGN.equals(patent.getPatentType())) { StringTokenizer tokenizer = tokenize(patent.getAbstract().getPlainText()); int tokens = tokenizer.countTokens(); if (patent.getAbstract() == null || patent.getAbstract().getPlainText().length() < 10) { MESSAGE = MESSAGE + " BELOW MINIMUM SIZE: 10; " + patent.getAbstract().getPlainText(); return false; } else if ((PatentDocFormat.RedbookGrant.equals(docFormat) || PatentDocFormat.RedbookApplication.equals(docFormat)) && tokens > 150) { MESSAGE = MESSAGE + " REDBOOK XML : ABOVE MAX WORD SIZE: 150; " + patent.getAbstract().getPlainText(); return false; } else if (tokens > 500) { MESSAGE = MESSAGE + " ABOVE MAX WORD SIZE: 500; " + patent.getAbstract().getPlainText(); return false; } } return true; }  @Override boolean test(Patent patent); @Override String getName(); @Override String getMessage(); StringTokenizer tokenize(String text);  }