SimpleModelTranslator implements ModelTranslator { @Override public <I, O> O translate(I input, Class<O> outputClass) { if (outputClass == null) { throw new IllegalArgumentException("outputClass is null"); } O output = null; if (input != null) { ObjectTranslator<I, O> translator = this.findTranslatorByClass( (Class<I>) input.getClass(), outputClass); output = translator.translate(this, input); } return output; } SimpleModelTranslator(); @Override ObjectTranslator<I, O> registerTranslator(ObjectTranslator<I, O> translator,
        Class<I> inputClass, Class<O> outputClass); @Override ObjectTranslator<I, O> unregisterTranslator(Class<I> inputClass, Class<O> outputClass); @Override int unregisterTranslator(ObjectTranslator translator); @Override ObjectTranslator<I, O> getTranslator(Class<I> inputClass, Class<O> outputClass); @Override ObjectTranslator<I, O> findTranslatorByClass(Class<I> inputClass, Class<O> outputClass); @Override ObjectTranslator<I, O> findTranslatorByInstance(I instance, Class<O> outputClass); @Override O translate(I input, Class<O> outputClass); @Override Function<I, O> getStreamMapper(Class<I> inputClass, Class<O> outputClass); @Override CandlepinQuery<O> translateQuery(CandlepinQuery<I> query, Class<O> outputClass);  }
@Test(expected = TranslationException.class) public void testTranslateWithoutTranslator() { ModelTranslator modelTranslator = new SimpleModelTranslator(); ObjectTranslator translator = new TestTranslator(); ModelEntity entity = new TestModelEntity() {}; TestDTO dto = modelTranslator.translate(entity, TestDTO.class); }