### Question:
Algorithm { public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException { byte[] contentBytes = new byte[headerBytes.length + 1 + payloadBytes.length]; System.arraycopy(headerBytes, 0, contentBytes, 0, headerBytes.length); contentBytes[headerBytes.length] = (byte) '.'; System.arraycopy(payloadBytes, 0, contentBytes, headerBytes.length + 1, payloadBytes.length); return sign(contentBytes); } protected  Algorithm(String name, String description); static Algorithm RSA256(RSAKeyProvider keyProvider); static Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey); @Deprecated static Algorithm RSA256(RSAKey key); static Algorithm RSA384(RSAKeyProvider keyProvider); static Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey); @Deprecated static Algorithm RSA384(RSAKey key); static Algorithm RSA512(RSAKeyProvider keyProvider); static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey); @Deprecated static Algorithm RSA512(RSAKey key); static Algorithm HMAC256(String secret); static Algorithm HMAC384(String secret); static Algorithm HMAC512(String secret); static Algorithm HMAC256(byte[] secret); static Algorithm ECDSA256K(ECDSAKeyProvider keyProvider); static Algorithm ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey); static Algorithm HMAC384(byte[] secret); static Algorithm HMAC512(byte[] secret); static Algorithm ECDSA256(ECDSAKeyProvider keyProvider); static Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey); @Deprecated static Algorithm ECDSA256(ECKey key); static Algorithm ECDSA384(ECDSAKeyProvider keyProvider); static Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey); @Deprecated static Algorithm ECDSA384(ECKey key); static Algorithm ECDSA512(ECDSAKeyProvider keyProvider); static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey); @Deprecated static Algorithm ECDSA512(ECKey key); static Algorithm none(); String getSigningKeyId(); String getName(); @Override String toString(); abstract void verify(DecodedJWT jwt); byte[] sign(byte[] headerBytes, byte[] payloadBytes); @Deprecated abstract byte[] sign(byte[] contentBytes);  }### Answer:
@Test public void shouldForwardHeaderPayloadSignatureToSiblingSignMethodForBackwardsCompatibility() throws Exception { Algorithm algorithm = mock(Algorithm.class); ArgumentCaptor<byte[]> contentCaptor = ArgumentCaptor.forClass(byte[].class); byte[] header = new byte[]{0x00, 0x01, 0x02}; byte[] payload = new byte[]{0x04, 0x05, 0x06}; byte[] signature = new byte[]{0x10, 0x11, 0x12}; when(algorithm.sign(any(byte[].class), any(byte[].class))).thenCallRealMethod(); when(algorithm.sign(contentCaptor.capture())).thenReturn(signature); byte[] sign = algorithm.sign(header, payload); ByteArrayOutputStream bout = new ByteArrayOutputStream(); bout.write(header); bout.write('.'); bout.write(payload); assertThat(sign, is(signature)); assertThat(contentCaptor.getValue(), is(bout.toByteArray())); }