Buggy code:
@ FixMethodOrder ( MethodSorters . NAME_ASCENDING ) public class ItemUpdateMetadataTest extends ItemTestBase { private static final Logger LOGGER = LoggerFactory . getLogger ( ItemUpdateMetadataTest . class ) ; protected static String updateJSON ; private static final String PATH_PREFIX = "//rest//items" ; private static URI unboundedStatementId ; @ BeforeClass public static void specificSetup ( ) throws Exception { } @ Test public void test_1_UpdateItem_1_Change_Metadata_Statements_Allowed_Common ( ) throws BadRequestException , IOException { final String CHANGED = "allowed_change" ; double NUM = 90 ; final String REP_CHANGED = ( "$1\"" + CHANGED ) + "\"" ; final String NUM_CHANGED = "$1" + NUM ; <START_BUG> DateFormat dateFormat = new SimpleDateFormat ( "YYYY-MM-DD" ) ; <END_BUG> Date date = new Date ( ) ; final String DATE_CHANGED = ( "$1\"" + ( dateFormat . format ( date ) ) ) + "\"" ; FormDataMultiPart multiPart = new FormDataMultiPart ( ) ; multiPart . field ( "json" , buildJSONFromObject ( itemTO ) . replace ( "___FILE_NAME___" , CHANGED ) . replaceAll ( "(\"text\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"familyName\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"givenName\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"completeName\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"alternativeName\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"role\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"name\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"description\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"country\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"city\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"number\"\\s*:\\s*).+" , NUM_CHANGED ) . replaceAll ( "(\"longitude\"\\s*:\\s*).+" , ( NUM_CHANGED + "," ) ) . replaceAll ( "(\"latitude\"\\s*:\\s*).+" , NUM_CHANGED ) . replaceAll ( "(\"date\"\\s*:\\s*)\"(.+)\"" , DATE_CHANGED ) . replaceAll ( "(\"license\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"url\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"link\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"format\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"publication\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) . replaceAll ( "(\"citation\"\\s*:\\s*)\"(.+)\"" , REP_CHANGED ) ) ; ItemUpdateMetadataTest . LOGGER . info ( multiPart . getField ( "json" ) . getValue ( ) ) ; Response response = target ( ItemUpdateMetadataTest . PATH_PREFIX ) . path ( ( "//" + ( itemId ) ) ) . queryParam ( "syntax" , RAW . toString ( ) . toLowerCase ( ) ) . register ( authAsUser ) . register ( MultiPartFeature . class ) . register ( JacksonFeature . class ) . request ( APPLICATION_JSON_TYPE ) . put ( Entity . entity ( multiPart , multiPart . getMediaType ( ) ) ) ; assertEquals ( response . getStatus ( ) , OK . getStatusCode ( ) ) ; ItemTO updatedItem = ( ( ItemTO ) ( response . readEntity ( ItemWithFileTO . class ) ) ) ; ItemUpdateMetadataTest . LOGGER . info ( buildJSONFromObject ( updatedItem ) ) ; assertThat ( updatedItem . getFilename ( ) , equalTo ( CHANGED ) ) ; List < MetadataSetTO > mds = updatedItem . getMetadata ( ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . TextTO ) ( mds . get ( 0 ) . getValue ( ) ) ) . getText ( ) , equalTo ( CHANGED ) ) ; final GeolocationTO geolocationTO = ( ( GeolocationTO ) ( mds . get ( 3 ) . getValue ( ) ) ) ; assertThat ( geolocationTO . getName ( ) , equalTo ( CHANGED ) ) ; assertThat ( geolocationTO . getLatitude ( ) , equalTo ( NUM ) ) ; assertThat ( geolocationTO . getLongitude ( ) , equalTo ( NUM ) ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . NumberTO ) ( mds . get ( 1 ) . getValue ( ) ) ) . getNumber ( ) , equalTo ( NUM ) ) ; PersonTO person = ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . ConePersonTO ) ( mds . get ( 2 ) . getValue ( ) ) ) . getPerson ( ) ; assertThat ( person . getFamilyName ( ) , equalTo ( CHANGED ) ) ; assertThat ( person . getGivenName ( ) , equalTo ( CHANGED ) ) ; final OrganizationTO organizationTO = person . getOrganizations ( ) . get ( 0 ) ; assertThat ( organizationTO . getName ( ) , equalTo ( CHANGED ) ) ; assertThat ( organizationTO . getCountry ( ) , equalTo ( CHANGED ) ) ; assertThat ( organizationTO . getCity ( ) , equalTo ( CHANGED ) ) ; assertThat ( organizationTO . getDescription ( ) , equalTo ( CHANGED ) ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . DateTO ) ( mds . get ( 4 ) . getValue ( ) ) ) . getDate ( ) , equalTo ( dateFormat . format ( date ) ) ) ; final LicenseTO licenseTO = ( ( LicenseTO ) ( mds . get ( 5 ) . getValue ( ) ) ) ; assertThat ( licenseTO . getLicense ( ) , equalTo ( CHANGED ) ) ; assertThat ( licenseTO . getUrl ( ) , equalTo ( CHANGED ) ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . LinkTO ) ( mds . get ( 6 ) . getValue ( ) ) ) . getLink ( ) , equalTo ( CHANGED ) ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . LinkTO ) ( mds . get ( 6 ) . getValue ( ) ) ) . getUrl ( ) , equalTo ( CHANGED ) ) ; assertThat ( ( ( de . mpg . imeji . rest . to . predefinedMetadataTO . PublicationTO ) ( mds . get ( 7 ) . getValue ( ) ) ) . getFormat ( ) , equalTo ( CHANGED ) ) ;

Fix:
DateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd" ) ;