### Question:
TokenBlobUtils { public String getBlobAsString(Token token) { Reject.ifNull(token); byte[] blob = token.getBlob(); if (blob == null) { return null; } try { return toUTF8(blob); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Failed to decode blob to " + ENCODING, e); } }  String getBlobAsString(Token token); void setBlobFromString(Token token, String blob); String toUTF8(byte[] data); byte[] fromUTF8(String contents); static final String ENCODING; }### Answer:
@Test public void shouldUseTokenForBlobAsString() throws CoreTokenException, UnsupportedEncodingException { given(mockToken.getBlob()).willReturn("badger".getBytes(TokenBlobUtils.ENCODING)); utils.getBlobAsString(mockToken); verify(mockToken).getBlob(); }
@Test public void shouldReturnNullIfTokenHasNoBinaryDataAssigned() { given(mockToken.getBlob()).willReturn(null); assertThat(utils.getBlobAsString(mockToken)).isNull(); }