### Question:
CoapTcpCSM { public boolean useBlockTransfer(byte[] payload) { return blockwiseTransfer && payload != null && payload.length > getMaxOutboundPayloadSize(); } CoapTcpCSM(long maxMessageSize, boolean blockwiseTransfer); static CoapTcpCSM min(CoapTcpCSM cap1, CoapTcpCSM cap2); CoapTcpCSM withNewOptions(Long maxMessageSize, Boolean blockwiseTransfer); boolean isBlockTransferEnabled(); boolean useBlockTransfer(byte[] payload); long getMaxMessageSize(); int getMaxMessageSizeInt(); boolean isBERTEnabled(); BlockSize getBlockSize(); int getMaxOutboundPayloadSize(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final CoapTcpCSM BASE; }### Answer:
@Test public void should_determine_to_use_block_transfer() { CoapTcpCSM csm = new CoapTcpCSM(512, false); assertFalse(csm.useBlockTransfer(null)); assertFalse(csm.useBlockTransfer(new byte[10])); csm = new CoapTcpCSM(512, true); assertFalse(csm.useBlockTransfer(null)); assertFalse(csm.useBlockTransfer(new byte[10])); assertTrue(csm.useBlockTransfer(new byte[513])); csm = new CoapTcpCSM(3000, true); assertFalse(csm.useBlockTransfer(null)); assertFalse(csm.useBlockTransfer(new byte[10])); assertTrue(csm.useBlockTransfer(new byte[3000])); }