@Test public void testUpdateInstrument() throws Exception { // Arrange DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); this.dataAcquisitionProjectRepository.save(project); Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), "SurveyId"); // Act and Assert // create the instrument with the given id mockMvc .perform( put(API_INSTRUMENTS_URI + "/" + instrument.getId()) .content(TestUtil.convertObjectToJsonBytes(instrument))) .andExpect(status().isCreated()); instrument.setTitle(new I18nString("Hurz2", "Hurz2")); // update the instrument with the given id mockMvc .perform( put(API_INSTRUMENTS_URI + "/" + instrument.getId()) .content(TestUtil.convertObjectToJsonBytes(instrument))) .andExpect(status().is2xxSuccessful()); // read the updated instrument and check the version mockMvc .perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId() + "?projection=complete")) .andExpect(status().isOk()) .andExpect(jsonPath("$.id", is(instrument.getId()))) .andExpect(jsonPath("$.version", is(1))) .andExpect(jsonPath("$.title.de", is("Hurz2"))); elasticsearchUpdateQueueService.processQueue(); // check that there are two instrument documents elasticsearchAdminService.refreshAllIndices(); assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(2.0)); }