### Question:
ModelController { public void update(final Context ctx, final String modeluri) { readPayload(ctx).ifPresentOrElse( eObject -> modelRepository.updateModel(modeluri, eObject) .ifPresentOrElse(__ -> { try { ctx.json(JsonResponse.fullUpdate(codecs.encode(ctx, eObject))); } catch (EncodingException e) { handleEncodingError(ctx, e); } sessionController.modelChanged(modeluri); }, () -> handleError(ctx, 404, "No such model resource to update")), () -> handleError(ctx, 400, "Update has no content")); } @Inject  ModelController(final ModelRepository modelRepository, final SessionController sessionController,
      final ServerConfiguration serverConfiguration); void create(final Context ctx, final String modeluri); void delete(final Context ctx, final String modeluri); void getAll(final Context ctx); void getOne(final Context ctx, final String modeluri); void update(final Context ctx, final String modeluri); void save(final Context ctx, final String modeluri); Handler getModelUrisHandler(); void executeCommand(final Context ctx, final String modelURI);  }### Answer:
@Ignore @Test public void updateXmi() throws EncodingException { final BrewingUnit brewingUnit = CoffeeFactory.eINSTANCE.createBrewingUnit(); final LinkedHashMap<String, List<String>> queryParams = new LinkedHashMap<>(); queryParams.put("format", Collections.singletonList("xmi")); when(context.queryParamMap()).thenReturn(queryParams); when(context.body()).thenReturn( Json.object(Json.prop("data", new XmiCodec().encode(brewingUnit))).toString()); when(modelRepository.getResourceSet()).thenReturn(new ResourceSetImpl()); modelController.update(context, "SuperBrewer3000.json"); verify(modelRepository, times(1)) .updateModel(eq("SuperBrewer3000.json"), any(BrewingUnit.class)); }