@Test public void testAddMetadata() throws ResourceInitializationException { FakeBaleenContentExtractor annotator = new MockedBaleenContentExtractor(); annotator.initialize( new CustomResourceSpecifier_impl(), ImmutableMap.of(Resource.PARAM_UIMA_CONTEXT, context)); Metadata md = annotator.addMetadata(jCas, KEY, VALUE); verify(support).add(md); assertNull(annotator.addMetadata(jCas, "", VALUE)); assertNull(annotator.addMetadata(jCas, null, VALUE)); assertNull(annotator.addMetadata(jCas, KEY, "")); assertNull(annotator.addMetadata(jCas, KEY, null)); resetMocked(); }
protected Metadata addMetadata(JCas jCas, String name, String value) { if (!Strings.isNullOrEmpty(name) && !Strings.isNullOrEmpty(value)) { Metadata md = new Metadata(jCas); md.setKey(name); md.setValue(value); addToJCasIndex(md); return md; } return null; }
BaleenContentExtractor extends Resource_ImplBase implements ContentExtractor { protected Metadata addMetadata(JCas jCas, String name, String value) { if (!Strings.isNullOrEmpty(name) && !Strings.isNullOrEmpty(value)) { Metadata md = new Metadata(jCas); md.setKey(name); md.setValue(value); addToJCasIndex(md); return md; } return null; } }
BaleenContentExtractor extends Resource_ImplBase implements ContentExtractor { protected Metadata addMetadata(JCas jCas, String name, String value) { if (!Strings.isNullOrEmpty(name) && !Strings.isNullOrEmpty(value)) { Metadata md = new Metadata(jCas); md.setKey(name); md.setValue(value); addToJCasIndex(md); return md; } return null; }  }
BaleenContentExtractor extends Resource_ImplBase implements ContentExtractor { protected Metadata addMetadata(JCas jCas, String name, String value) { if (!Strings.isNullOrEmpty(name) && !Strings.isNullOrEmpty(value)) { Metadata md = new Metadata(jCas); md.setKey(name); md.setValue(value); addToJCasIndex(md); return md; } return null; }  @Override final boolean initialize(ResourceSpecifier specifier, Map<String, Object> additionalParams); abstract void doInitialize(UimaContext context, Map<String, Object> params); @Override final void processStream(InputStream stream, String source, JCas jCas); @Override final void destroy(); }
BaleenContentExtractor extends Resource_ImplBase implements ContentExtractor { protected Metadata addMetadata(JCas jCas, String name, String value) { if (!Strings.isNullOrEmpty(name) && !Strings.isNullOrEmpty(value)) { Metadata md = new Metadata(jCas); md.setKey(name); md.setValue(value); addToJCasIndex(md); return md; } return null; }  @Override final boolean initialize(ResourceSpecifier specifier, Map<String, Object> additionalParams); abstract void doInitialize(UimaContext context, Map<String, Object> params); @Override final void processStream(InputStream stream, String source, JCas jCas); @Override final void destroy(); static final String KEY_HISTORY; }