C10NTools { public static C10NInspectorBuilder inspectorBuilder() { return new C10NInspectorBuilder(); }  static C10NInspectorBuilder inspectorBuilder();  }
@Test public void builderHonorsCheckLocalesAndDummyInstanceProvider() { C10NInspector inspector = C10NTools.inspectorBuilder() .checkLocales(Locale.ENGLISH, Locale.JAPANESE) .dummyInstanceProvider(new MyDummyInstanceProvider()) .module(C10N.configure(new DefaultC10NAnnotations())) .build(); List<C10NUnit> units = inspector.inspect(getClass().getPackage().getName()); checkUnit(units, C10NToolsTestMsg.class, method("greeting", String.class), anyKey(), annotationTr(Locale.ENGLISH, "[en]Hello, dummy!", "[en]Hello, {0}!"), annotationTr(Locale.JAPANESE, "[ja]Hello, dummy!", "[ja]Hello, {0}!")); }
@Test public void builderHonorsFetchTranslations() { C10NInspector inspector = C10NTools.inspectorBuilder() .checkLocales(Locale.ENGLISH, Locale.FRENCH) .fetchTranslations(false) .module(C10N.configure(new DefaultC10NAnnotations())) .build(); List<C10NUnit> units = inspector.inspect(getClass().getPackage().getName()); checkUnit(units, C10NToolsTestMsg.class, method("greeting", String.class), anyKey(), annotationTr(Locale.ENGLISH, null), annotationTr(Locale.FRENCH, null)); }
@Test public void builderUsesSensibleDefaultValues() { C10N.configure(new C10NConfigBase() { @Override protected void configure() { bindAnnotation(En.class).toLocale(Locale.ENGLISH); bindAnnotation(Ja.class).toLocale(Locale.JAPANESE); } }); C10NInspector inspector = C10NTools.inspectorBuilder().build(); List<C10NUnit> units = inspector.inspect(getClass().getPackage().getName()); checkUnit(units, C10NToolsTestMsg.class, method("greeting", String.class), anyKey(), annotationTr(Locale.ENGLISH, "[en]Hello, {0}!", "[en]Hello, {0}!"), annotationTr(Locale.JAPANESE, "[ja]Hello, {0}!", "[ja]Hello, {0}!")); }