Package samples.expectnew
Class ExpectNewDemo
- java.lang.Object
-
- samples.expectnew.ExpectNewDemo
-
public class ExpectNewDemo extends Object
-
-
Constructor Summary
Constructors Constructor Description ExpectNewDemo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamalternativePath()booleanequals(Object obj)booleanfileExists(String name)voidfileWriter(String name, String msg)voidfileWriterPrint(String name, String msg)StringgetMessage()StringgetMessageWithArgument()inthashCode()voidinvokeVoidMethod()DatemakeDate()StringmultipleNew()byte[][]newVarArgs(byte[]... bytes)int[]newVarArgs(float myFloat, int... ints)String[]newVarArgs(String... strings)Service[]newVarArgs(Service... services)byte[][]newVarArgsWithMatchers()StringnewWithArguments(Service service, int times)StringnewWithWrongArguments(Service service, int times)voidsimpleMultipleNew()voidsimpleSingleNew()voidthrowExceptionAndWrapInRunTimeWhenInvoction()The purpose of the method is to demonstrate that a test case can mock the new instance call and throw an exception upon instantiation.voidthrowExceptionWhenInvoction()The purpose of the method is to demonstrate that a test case can mock the new instance call and throw an exception upon instantiation.
-
-
-
Method Detail
-
getMessage
public String getMessage()
-
getMessageWithArgument
public String getMessageWithArgument()
-
invokeVoidMethod
public void invokeVoidMethod()
-
throwExceptionWhenInvoction
public void throwExceptionWhenInvoction()
The purpose of the method is to demonstrate that a test case can mock the new instance call and throw an exception upon instantiation.
-
throwExceptionAndWrapInRunTimeWhenInvoction
public void throwExceptionAndWrapInRunTimeWhenInvoction()
The purpose of the method is to demonstrate that a test case can mock the new instance call and throw an exception upon instantiation.
-
multipleNew
public String multipleNew()
-
simpleMultipleNew
public void simpleMultipleNew()
-
simpleSingleNew
public void simpleSingleNew()
-
makeDate
public Date makeDate()
-
fileExists
public boolean fileExists(String name)
-
alternativePath
public InputStream alternativePath()
-
newVarArgs
public int[] newVarArgs(float myFloat, int... ints)
-
newVarArgs
public byte[][] newVarArgs(byte[]... bytes)
-
newVarArgsWithMatchers
public byte[][] newVarArgsWithMatchers()
-
fileWriter
public void fileWriter(String name, String msg) throws IOException
- Throws:
IOException
-
fileWriterPrint
public void fileWriterPrint(String name, String msg) throws IOException
- Throws:
IOException
-
-