mock/readwritecloser.go
func (r *MockReadWriteCloser) Write(p []byte) (n int, err error) {

	if err = r.WriteErr; err != nil {
		r.BytesWritten = p
		n = len(p)
	}
	return
}
func (r *MockReadWriteCloser) Write(p []byte) (n int, err error) {

	if err = r.WriteErr; err != nil {
		r.BytesWritten = p
		n = len(p)
	}
	return
}
func ( r * MockReadWriteCloser ) Write ( p [ ] byte ) ( n int , err error ) { if err = r . WriteErr ; err != nil { r . BytesWritten = p n = len ( p ) } return }
//Write - satisfies writer interface
Write - satisfies writer interface