### Question:
ProduceRequest extends AbstractRequest { public boolean isIdempotent() { return idempotent; } private  ProduceRequest(short version, short acks, int timeout, Map<TopicPartition, MemoryRecords> partitionRecords, String transactionalId);  ProduceRequest(Struct struct, short version); @Override Struct toStruct(); @Override String toString(boolean verbose); @Override ProduceResponse getErrorResponse(int throttleTimeMs, Throwable e); short acks(); int timeout(); String transactionalId(); boolean isTransactional(); boolean isIdempotent(); Map<TopicPartition, MemoryRecords> partitionRecordsOrFail(); void clearPartitionRecords(); static ProduceRequest parse(ByteBuffer buffer, short version); static byte requiredMagicForVersion(short produceRequestVersion);  }### Answer:
@Test public void shouldBeFlaggedAsIdempotentWhenIdempotentRecords() throws Exception { final MemoryRecords memoryRecords = MemoryRecords.withIdempotentRecords(1, CompressionType.NONE, 1L, (short) 1, 1, 1, simpleRecord); final ProduceRequest request = new ProduceRequest.Builder(RecordBatch.CURRENT_MAGIC_VALUE, (short) -1, 10, Collections.singletonMap( new TopicPartition("topic", 1), memoryRecords)).build(); assertTrue(request.isIdempotent()); }