# MiscTest

### Summary

The javax.servlet.jsp.JspWriter interface emulates some of the functionality found in java.io.Writer,java.io.BufferedWriter and java.io.PrintWriter, however it differs in throwing the java.io.IOException from the print methods.

### Positive Tests

positiveClear Test: Initially we write something to the buffer and later we call the clear method. If we get a blank page output, clear works.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveClear -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveClose Test: Write something to the stream and then close it. After closing try to write something to the stream.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveClose -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveFlush Test: Write some thing into the buffer and then call the method.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveFlush -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveGetBufferSize Test: Set the buffer size,with buffer directive,then use the getBufferSize() method.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveGetBufferSize -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveGetBufferSizeUnBuffered Test: Set the buffer directive to 'none'. Then call the method

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveGetBufferSizeUnBuffered -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveGetRemaining Test: Set the buffer using the buffer directive and then call the method.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveGetRemaining -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveGetRemainingBufferUnset Test: Set the buffer directive to 'none' and call the method getRemaining() in the JSP page.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveGetRemainingBufferUnset -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveIsAutoFlush Test: Set the autoflush directive to 'true' and then call the method(Should work with out setting this directive , as it is true by default)

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveIsAutoFlush -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveNewLine Test: Call the method in the JSP page.Check for number of new lines in the code generated.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID positiveNewLine -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

### Negative Tests

negativeClose Test: We are closing the stream. After closing we trying to write to the output stream.It throws IOException.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID negativeClose -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeClearUnbuffered Test: We are unbuffering using directive(buffer="none"),we expecting IllegalStateException as error

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID negativeClearUnbuffered -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeClearIOExpr Test: We closing stream before clear method is called,This results in IOException as error message

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID negativeClearIOExpr -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeFlush Test: We are testing if method flush() flushes the contents of the buffer.Initially we write something into buffer and later call the flush method.

title | MiscTest
source | MiscTest.java
executeClass | engine.JspWriter.misc.MiscTest
executeArgs | -TestCaseID negativeFlush -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI