UpdateViewHook implements GraphHook { protected final View.Builder mergeView(final OperationView operationView, final View viewToMerge) { final View.Builder viewBuilder = new View.Builder(); if (!(operationView.getView() instanceof NamedView)) { viewBuilder.merge(operationView.getView()); } if (null != viewToMerge) { viewBuilder.merge(viewToMerge.clone()); } return viewBuilder; }  @Override void preExecute(final OperationChain<?> opChain, final Context context); @Override T postExecute(final T result, final OperationChain<?> opChain, final Context context); @Override T onFailure(final T result, final OperationChain<?> opChain, final Context context, final Exception e); Set<String> getWithOpAuth(); UpdateViewHook setWithOpAuth(final Set<String> withOpAuth); Set<String> getWithoutOpAuth(); UpdateViewHook setWithoutOpAuth(final Set<String> withoutOpAuth); Set<String> getWithDataAuth(); UpdateViewHook setWithDataAuth(final Set<String> withDataAuth); Set<String> getWithoutDataAuth(); UpdateViewHook setWithoutDataAuth(final Set<String> withoutDataAuth); Set<String> getWhiteListElementGroups(); UpdateViewHook setWhiteListElementGroups(final Set<String> whiteListElementGroups); Set<String> getBlackListElementGroups(); UpdateViewHook setBlackListElementGroups(final Set<String> blackListElementGroups); UpdateViewHook setViewToMerge(final View viewToMerge); View getViewToMerge(); boolean isAddExtraGroups(); UpdateViewHook setAddExtraGroups(final boolean addExtraGroups); static final boolean ADD_EXTRA_GROUPS_DEFAULT; }
@Test public void shouldDoNothingWithNullMerge() throws Exception { GetAllElements operationView = new GetAllElements(); operationView.setView(new View()); View view = updateViewHook.mergeView(operationView, null).build(); assertTrue(view.getGroups().isEmpty()); }
@Test public void shouldMerge() throws Exception { GetAllElements operationView = new GetAllElements(); operationView.setView(new View()); View view = updateViewHook.mergeView(operationView, viewToMerge).build(); Set<String> groups = view.getGroups(); assertFalse(groups.isEmpty()); assertTrue(groups.contains("testGroup")); }