### Question:
RemoteSnapshotMetadata extends MavenSnapshotMetadata { @Override protected void merge( Metadata recessive ) { Snapshot snapshot; String lastUpdated; if ( metadata.getVersioning() == null ) { DateFormat utcDateFormatter = new SimpleDateFormat( DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT ); utcDateFormatter.setCalendar( new GregorianCalendar() ); utcDateFormatter.setTimeZone( DEFAULT_SNAPSHOT_TIME_ZONE ); snapshot = new Snapshot(); snapshot.setBuildNumber( getBuildNumber( recessive ) + 1 ); snapshot.setTimestamp( utcDateFormatter.format( new Date() ) ); Versioning versioning = new Versioning(); versioning.setSnapshot( snapshot ); versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) ); lastUpdated = versioning.getLastUpdated(); metadata.setVersioning( versioning ); } else { snapshot = metadata.getVersioning().getSnapshot(); lastUpdated = metadata.getVersioning().getLastUpdated(); } for ( Artifact artifact : artifacts ) { String version = artifact.getVersion(); if ( version.endsWith( SNAPSHOT ) ) { String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier; } SnapshotVersion sv = new SnapshotVersion(); sv.setClassifier( artifact.getClassifier() ); sv.setExtension( artifact.getExtension() ); sv.setVersion( version ); sv.setUpdated( lastUpdated ); versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv ); } artifacts.clear(); Versioning versioning = recessive.getVersioning(); if ( versioning != null ) { for ( SnapshotVersion sv : versioning.getSnapshotVersions() ) { String key = getKey( sv.getClassifier(), sv.getExtension() ); if ( !versions.containsKey( key ) ) { versions.put( key, sv ); } } } if ( !legacyFormat ) { metadata.getVersioning().setSnapshotVersions( new ArrayList<>( versions.values() ) ); } } RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat ); private  RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat ); MavenMetadata setFile( File file ); String getExpandedVersion( Artifact artifact ); static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT; static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE; }### Answer:
@Test public void gregorianCalendarIsUsed() { String dateBefore = gregorianDate(); RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata( new DefaultArtifact( "a:b:1-SNAPSHOT" ), false); metadata.merge( new Metadata() ); String dateAfter = gregorianDate(); String ts = metadata.metadata.getVersioning().getSnapshot().getTimestamp(); String datePart = ts.replaceAll( "\\..*", "" ); Set<String> expected = new HashSet<>( Arrays.asList( dateBefore, dateAfter ) ); assertTrue( "Expected " + datePart + " to be in " + expected, expected.contains( datePart ) ); }