OakpalPlan implements JsonObjectConvertible { void initResourceBundle(final ViolationReporter reporter, final Locale locale, final ClassLoader classLoader) { if (reporter.getResourceBundleBaseName() != null) { Fun.result0(() -> ResourceBundle .getBundle(reporter.getResourceBundleBaseName(), locale, classLoader)).get() .forEach(reporter::setResourceBundle); } } private  OakpalPlan(final @Nullable URL base,
                       final @Nullable JsonObject originalJson,
                       final @NotNull String name,
                       final @NotNull List<String> runModes,
                       final @NotNull List<String> checklists,
                       final @NotNull List<URL> preInstallUrls,
                       final @NotNull List<JcrNs> jcrNamespaces,
                       final @NotNull List<QNodeTypeDefinition> jcrNodetypes,
                       final @NotNull List<PrivilegeDefinition> jcrPrivileges,
                       final @NotNull List<ForcedRoot> forcedRoots,
                       final @NotNull List<CheckSpec> checks,
                       final boolean enablePreInstallHooks,
                       final @Nullable InstallHookPolicy installHookPolicy,
                       final @NotNull List<URL> repoInitUrls,
                       final @NotNull List<String> repoInits); @NotNull static JsonKeys keys(); URL getBase(); String getName(); JsonObject getOriginalJson(); List<String> getRunModes(); List<String> getChecklists(); List<URL> getPreInstallUrls(); List<JcrNs> getJcrNamespaces(); List<QNodeTypeDefinition> getJcrNodetypes(); List<PrivilegeDefinition> getJcrPrivileges(); List<ForcedRoot> getForcedRoots(); List<CheckSpec> getChecks(); boolean isEnablePreInstallHooks(); InstallHookPolicy getInstallHookPolicy(); List<URL> getRepoInitUrls(); List<String> getRepoInits(); @Override JsonObject toJson(); @Override String toString(); OakMachine.Builder toOakMachineBuilder(final @Nullable ErrorListener errorListener,
                                                  final @NotNull ClassLoader classLoader); static OakpalPlan fromJson(final @NotNull JsonObject json); static Result<OakpalPlan> fromJson(final @NotNull URL jsonUrl); static final URL EMPTY_PLAN_URL; static final URL BASIC_PLAN_URL; static final String DEFAULT_PLAN_NAME; }
@Test public void testInitResourceBundle() throws Exception { CompletableFuture<ResourceBundle> callback = new CompletableFuture<>(); OakpalPlan plan = builder().build(); ProgressCheck check = mock(ProgressCheck.class); doAnswer(call -> callback.complete(call.getArgument(0))) .when(check).setResourceBundle(nullable(ResourceBundle.class)); when(check.getResourceBundleBaseName()).thenReturn(null); plan.initResourceBundle(check, Locale.getDefault(), getClass().getClassLoader()); assertFalse("expect callback not done", callback.isDone()); when(check.getResourceBundleBaseName()).thenReturn(getClass().getName()); plan.initResourceBundle(check, Locale.getDefault(), getClass().getClassLoader()); assertSame("expect callback complete with", ResourceBundle.getBundle(getClass().getName()), callback.getNow(null)); }