### Question:
BlockWiseTransfer { static boolean isBlockPacketValid(CoapPacket packet, BlockOption blockOpt) { if (!blockOpt.hasMore()) { return true; } int payloadSize = packet.getPayload().length; int blockSize = blockOpt.getSize(); if (blockOpt.isBert()) { return payloadSize > 0 && payloadSize % blockSize == 0; } else { return payloadSize == blockSize; } } BlockWiseTransfer(CoapTcpCSMStorage capabilities);   }### Answer:
@Test public void should_validate_packet_with_block() { assertTrue(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[100]).post().build(), new BlockOption(1, BlockSize.S_512, false))); assertTrue(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[1024]).post().build(), new BlockOption(2, BlockSize.S_1024_BERT, true))); assertTrue(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[512]).post().build(), new BlockOption(3, BlockSize.S_512, true))); assertFalse(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[1023]).post().build(), new BlockOption(2, BlockSize.S_1024_BERT, true))); assertFalse(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[0]).post().build(), new BlockOption(2, BlockSize.S_1024_BERT, true))); assertFalse(isBlockPacketValid(newCoapPacket(LOCAL_5683).payload(new byte[511]).post().build(), new BlockOption(3, BlockSize.S_512, true))); }