### Question:
MockProducer implements Producer<K, V> { public boolean flushed() { return this.completions.isEmpty(); } MockProducer(final Cluster cluster,
                        final boolean autoComplete,
                        final Partitioner partitioner,
                        final Serializer<K> keySerializer,
                        final Serializer<V> valueSerializer);  MockProducer(final boolean autoComplete,
                        final Serializer<K> keySerializer,
                        final Serializer<V> valueSerializer);  MockProducer(final boolean autoComplete,
                        final Partitioner partitioner,
                        final Serializer<K> keySerializer,
                        final Serializer<V> valueSerializer);  MockProducer(); @Override void initTransactions(); @Override void beginTransaction(); @Override void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offsets,
                                         String consumerGroupId); @Override void commitTransaction(); @Override void abortTransaction(); @Override synchronized Future<RecordMetadata> send(ProducerRecord<K, V> record); @Override synchronized Future<RecordMetadata> send(ProducerRecord<K, V> record, Callback callback); synchronized void flush(); List<PartitionInfo> partitionsFor(String topic); Map<MetricName, Metric> metrics(); @Override void close(); @Override void close(long timeout, TimeUnit timeUnit); boolean closed(); void fenceProducer(); boolean transactionInitialized(); boolean transactionInFlight(); boolean transactionCommitted(); boolean transactionAborted(); boolean flushed(); boolean sentOffsets(); long commitCount(); synchronized List<ProducerRecord<K, V>> history(); synchronized List<Map<String, Map<TopicPartition, OffsetAndMetadata>>> consumerGroupOffsetsHistory(); synchronized void clear(); synchronized boolean completeNext(); synchronized boolean errorNext(RuntimeException e);  }### Answer:
@Test public void shouldBeFlushedIfNoBufferedRecords() { assertTrue(producer.flushed()); }