@Test public void testTranslate_cachedBuildTypeNotFound() { SimpleCache cache = new SimpleCache(); Entity build = new Entity("build-instance", 4546); build.setProperty("number", "1563"); build.setProperty("type", 110); cache.add(build); cache.addNotFound(new EntityRef("build-type", 110)); EntityReferenceTranslator translator = new EntityReferenceTranslator(getProject(), "build-instance", cache); RestInvocations.loadMetadata(handler, "build-instance"); String name = translator.translate("4546", new ValueCallback() { @Override public void value(final String value) { Assert.fail("not expected"); } }); Assert.assertEquals("N/A #1563", name); }
@Override public String translate(String value, ValueCallback callback) { return new Execution(callback).perform(value); }
EntityReferenceTranslator implements Translator { @Override public String translate(String value, ValueCallback callback) { return new Execution(callback).perform(value); } }
EntityReferenceTranslator implements Translator { @Override public String translate(String value, ValueCallback callback) { return new Execution(callback).perform(value); } EntityReferenceTranslator(Project project, String targetType, SimpleCache cache); }
EntityReferenceTranslator implements Translator { @Override public String translate(String value, ValueCallback callback) { return new Execution(callback).perform(value); } EntityReferenceTranslator(Project project, String targetType, SimpleCache cache); @Override String translate(String value, ValueCallback callback); String getTargetType(); }
EntityReferenceTranslator implements Translator { @Override public String translate(String value, ValueCallback callback) { return new Execution(callback).perform(value); } EntityReferenceTranslator(Project project, String targetType, SimpleCache cache); @Override String translate(String value, ValueCallback callback); String getTargetType();  }