RecordUtils { public static String gavceForRecord(final Record record) { String g = record.get(Record.GROUP_ID); String a = record.get(Record.ARTIFACT_ID); String v = record.get(Record.VERSION); String ce = defaultIfBlank(record.get(CLASSIFIER), "n/a") + ":" + record.get(FILE_EXTENSION); return g + a + v + ce; } private  RecordUtils(); static String gavceForRecord(final Record record);  }
@Test public void shouldConvertRecordToGavce() throws Exception { Record record = new Record(ARTIFACT_ADD, ImmutableMap.of(GROUP_ID, GROUP, ARTIFACT_ID, ARTIFACT, Record.VERSION, VERSION, Record.CLASSIFIER, CLASSIFIER, FILE_EXTENSION, EXTENSION)); assertThat(gavceForRecord(record), is(equalTo(GROUP + ARTIFACT + VERSION + CLASSIFIER + ":" + EXTENSION))); }
@Test public void shouldHandleBlankClassifierWhenConvertRecordToGavce() throws Exception { String c = ""; Record record = new Record(ARTIFACT_ADD, ImmutableMap.of(GROUP_ID, GROUP, ARTIFACT_ID, ARTIFACT, Record.VERSION, VERSION, Record.CLASSIFIER, c, FILE_EXTENSION, EXTENSION)); assertThat(gavceForRecord(record), is(equalTo(GROUP + ARTIFACT + VERSION + "n/a" + ":" + EXTENSION))); }