/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.io.test;

import static org.junit.jupiter.api.Assertions.fail;

import java.io.IOException;
import java.io.OutputStream;

import org.apache.commons.io.output.ProxyOutputStream;

/**
 * Helper class for checking behavior of IO classes.
 */
public class ThrowOnFlushAndCloseOutputStream extends ProxyOutputStream {

    private boolean yellOnFlush;
    private boolean yellOnClose;

    /**
     * @param proxy OutputStream to delegate to.
     * @param yellOnFlush True if flush() is forbidden
     * @param yellOnClose True if close() is forbidden
     */
    public ThrowOnFlushAndCloseOutputStream(final OutputStream proxy, final boolean yellOnFlush, final boolean yellOnClose) {
        super(proxy);
        this.yellOnFlush = yellOnFlush;
        this.yellOnClose = yellOnClose;
    }

    /** @see java.io.OutputStream#flush() */
    @Override
    public void flush() throws IOException {
        if (yellOnFlush) {
            fail(getClass().getSimpleName() + ".flush() called.");
        }
        super.flush();
    }

    /** @see java.io.OutputStream#close() */
    @Override
    public void close() throws IOException {
        if (yellOnClose) {
            fail(getClass().getSimpleName() + ".close() called.");
        }
        super.close();
    }

    public void off() {
        yellOnFlush = false;
        yellOnClose = false;
    }

}

@@ -1153,28 +1153,29 @@
 ate boolean 
-yell
+throw
 OnFlush;%0A   
@@ -1187,28 +1187,29 @@
 ate boolean 
-yell
+throw
 OnClose;%0A%0A  
@@ -1277,20 +1277,21 @@
  @param 
-yell
+throw
 OnFlush 
@@ -1333,20 +1333,21 @@
  @param 
-yell
+throw
 OnClose 
@@ -1471,20 +1471,21 @@
 ean 
-yell
+throw
 OnFlush,
  fin
@@ -1480,16 +1480,24 @@
 OnFlush,
+%0A       
  final b
@@ -1503,20 +1503,21 @@
 boolean 
-yell
+throw
 OnClose)
@@ -1554,20 +1554,21 @@
    this.
-yell
+throw
 OnFlush 
@@ -1569,20 +1569,21 @@
 Flush = 
-yell
+throw
 OnFlush;
@@ -1596,20 +1596,21 @@
    this.
-yell
+throw
 OnClose 
@@ -1611,20 +1611,21 @@
 Close = 
-yell
+throw
 OnClose;
@@ -1748,20 +1748,21 @@
     if (
-yell
+throw
 OnFlush)
@@ -1987,20 +1987,21 @@
     if (
-yell
+throw
 OnClose)
@@ -2142,20 +2142,21 @@
         
-yell
+throw
 OnFlush 
@@ -2176,12 +2176,13 @@
     
-yell
+throw
 OnCl

Rename test classes from "Yell" to "Throw" prefix.