@Test public void shouldUpdateToken() throws TokenStrategyFailedException { Token token = mock(Token.class); byte[] testData = JSON_SAMPLE.getBytes(); given(token.getBlob()).willReturn(testData); compression.perform(token); verify(token).setBlob(any(byte[].class)); }
@Override public void perform(Token token) throws TokenStrategyFailedException { bout.reset(); try { GZIPOutputStream out = new GZIPOutputStream(bout); out.write(token.getBlob(), 0, token.getBlob().length); out.flush(); out.close(); } catch (IOException e) { throw new TokenStrategyFailedException(e); } token.setBlob(bout.toByteArray()); }
CompressionStrategy implements BlobStrategy { @Override public void perform(Token token) throws TokenStrategyFailedException { bout.reset(); try { GZIPOutputStream out = new GZIPOutputStream(bout); out.write(token.getBlob(), 0, token.getBlob().length); out.flush(); out.close(); } catch (IOException e) { throw new TokenStrategyFailedException(e); } token.setBlob(bout.toByteArray()); } }
CompressionStrategy implements BlobStrategy { @Override public void perform(Token token) throws TokenStrategyFailedException { bout.reset(); try { GZIPOutputStream out = new GZIPOutputStream(bout); out.write(token.getBlob(), 0, token.getBlob().length); out.flush(); out.close(); } catch (IOException e) { throw new TokenStrategyFailedException(e); } token.setBlob(bout.toByteArray()); }  }
CompressionStrategy implements BlobStrategy { @Override public void perform(Token token) throws TokenStrategyFailedException { bout.reset(); try { GZIPOutputStream out = new GZIPOutputStream(bout); out.write(token.getBlob(), 0, token.getBlob().length); out.flush(); out.close(); } catch (IOException e) { throw new TokenStrategyFailedException(e); } token.setBlob(bout.toByteArray()); }  @Override void perform(Token token); @Override void reverse(Token token); }
CompressionStrategy implements BlobStrategy { @Override public void perform(Token token) throws TokenStrategyFailedException { bout.reset(); try { GZIPOutputStream out = new GZIPOutputStream(bout); out.write(token.getBlob(), 0, token.getBlob().length); out.flush(); out.close(); } catch (IOException e) { throw new TokenStrategyFailedException(e); } token.setBlob(bout.toByteArray()); }  @Override void perform(Token token); @Override void reverse(Token token);  }