@Test
public void testWrite() throws Exception {

	DDMFormInstanceRecordExporterImpl ddmFormInstanceRecordExporterImpl =
		new DDMFormInstanceRecordExporterImpl();
	ddmFormInstanceRecordExporterImpl.ddmFormInstanceRecordWriterTracker =
		_ddmFormInstanceRecordWriterTracker;
	DDMFormInstanceRecordWriter ddmFormInstanceRecordWriter = mock(
		DDMFormInstanceRecordWriter.class);
	when(
		_ddmFormInstanceRecordWriterTracker.getDDMFormInstanceRecordWriter(
			"txt")
	).thenReturn(
		ddmFormInstanceRecordWriter
	);
	DDMFormInstanceRecordWriterResponse.Builder builder =
		DDMFormInstanceRecordWriterResponse.Builder.newBuilder(
			new byte[] {1, 2, 3});
	when(
		ddmFormInstanceRecordWriter.write(
			Matchers.any(DDMFormInstanceRecordWriterRequest.class))
	).thenReturn(
		builder.build()
	);
	byte[] content = ddmFormInstanceRecordExporterImpl.write(
		"txt", Collections.emptyMap(), Collections.emptyList());
	Assert.assertArrayEquals(new byte[] {1, 2, 3}, content);
	InOrder inOrder = Mockito.inOrder(
		_ddmFormInstanceRecordWriterTracker, ddmFormInstanceRecordWriter);
	inOrder.verify(
		_ddmFormInstanceRecordWriterTracker, Mockito.times(1)
	).getDDMFormInstanceRecordWriter(
		"txt"
	);
	inOrder.verify(
		ddmFormInstanceRecordWriter, Mockito.times(1)
	).write(
		Matchers.any(DDMFormInstanceRecordWriterRequest.class)
	);
}