You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: printer_test.go
    path of file: ./repos/mattermost/server/cmd/mmctl/printer
    
    the code of the file until where you have to start completion: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package printer

import (
	"bufio"
	"bytes"
	"testing"
	"text/template"

	"github.com/stretchr/testify/assert"
)

type mockWriter []byte

func (w *mockWriter) Write(b []byte) (n int, err error) {
	*w = append(*w, b...)
	return len(*w) - len(b), nil
}

func TestPrintT(t *testing.T) {
	w := bufio.NewWriter(&bytes.Buffer{})
	printer.writer = w
	printer.Format = FormatPlain

	ts := struct {
		ID int
	}{
		ID: 123,
	}

	t.Run("should execute templa
    
func TestFlushJSON(t *testing.T) {
	printer.Format = FormatJSON

	t.Run("should print a line in JSON format", func(t *testing.T) {
		mw := &mockWriter{}
		printer.writer = mw
		Clean()

		Print("test string")
		assert.Len(t, GetLines(), 1)

		_ = Flush()
		assert.Equal(t, "[\n  \"test string\"\n]\n", string(*mw))
		assert.Empty(t, GetLines(), 0)
	})

	t.Run("should print multi line in JSON format", func(t *testing.T) {
		mw := &mockWriter{}
		printer.writer = mw

		Clean()
		Print("test string-1")
		Print("test string-2")
		assert.Len(t, GetLines(), 2)

		_ = Flush()
		assert.Equal(t, "[\n  \"test string-1\",\n  \"test string-2\"\n]\n", string(*mw))
		assert.Empty(t, GetLines(), 0)
	})
}