### Question:
AbstractClientDiagramService implements ClientDiagramService<M, D, S> { protected void updateClientMetadata(final D diagram) { if (null != diagram) { final Metadata metadata = diagram.getMetadata(); if (null != metadata && isEmpty(metadata.getShapeSetId())) { final String sId = shapeManager.getDefaultShapeSet(metadata.getDefinitionSetId()).getId(); metadata.setShapeSetId(sId); } } } AbstractClientDiagramService(final ShapeManager shapeManager,
                                        final SessionManager sessionManager,
                                        final Caller<S> diagramServiceCaller,
                                        final Caller<DiagramLookupService> diagramLookupServiceCaller,
                                        final Event<SessionDiagramSavedEvent> saveEvent); @Override void create(final Path path,
                       final String name,
                       final String defSetId,
                       final ServiceCallback<Path> callback); @Override @SuppressWarnings("unchecked") void saveOrUpdate(final D diagram,
                             final ServiceCallback<D> callback); @Override void saveOrUpdateSvg(Path diagramPath, String rawSvg, ServiceCallback<Path> callback); @Override void add(final D diagram,
                    final ServiceCallback<D> callback); @Override @SuppressWarnings("unchecked") void getByPath(final Path path,
                          final ServiceCallback<D> callback); @Override @SuppressWarnings("unchecked") void lookup(final DiagramLookupRequest request,
                       final ServiceCallback<LookupManager.LookupResponse<DiagramRepresentation>> callback); @Override void getRawContent(final D diagram,
                              final ServiceCallback<String> callback);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testUpdateClientMetadata() { final String ssid = "shapeSet1"; final ShapeSet shapeSet = mock(ShapeSet.class); final ServiceCallback<D> callback = mock(ServiceCallback.class); when(shapeSet.getId()).thenReturn(ssid); when(shapeManager.getDefaultShapeSet(anyString())).thenReturn(shapeSet); when(metadata.getShapeSetId()).thenReturn(null); when(diagramService.getDiagramByPath(eq(path))).thenReturn(diagram); tested.add(diagram, callback); tested.saveOrUpdate(diagram, callback); tested.getByPath(path, callback); verify(metadata, times(3)).setShapeSetId(eq(ssid)); }