SequenceHeaderUtil { public String createSequenceHeader(final String headerSource, final String sequenceId) { String result = ""; if (headerSource == null) { result = sequenceId; } else { StringBuilder sb = new StringBuilder(headerSource); sb.append(SequenceConstants.SEQUENCE_KEY_SEPARATOR.getConstant()).append(sequenceId); result = sb.toString(); } return result; }  String createSequenceHeader(final String headerSource, final String sequenceId); String[] resolveSequenceHeader(final String headerSource);  }
@Test public void testCreateSequenceHeaderWhenTheSourceIsEmpty() { String testKey = "TestKey1"; String result = underTest.createSequenceHeader(null, testKey); Assert.assertEquals(result, testKey); }
@Test public void testCreateSequenceHeaderWhenThereIsSourceParameter() { String testKeyFirst = "TestKey1"; String testKeySecond = "TestKey2"; String expected = testKeyFirst + SequenceConstants.SEQUENCE_KEY_SEPARATOR.getConstant() + testKeySecond; String result = underTest.createSequenceHeader(testKeyFirst, testKeySecond); Assert.assertEquals(result, expected); }