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 InputStream
alternativePath()
boolean
equals(Object obj)
boolean
fileExists(String name)
void
fileWriter(String name, String msg)
void
fileWriterPrint(String name, String msg)
String
getMessage()
String
getMessageWithArgument()
int
hashCode()
void
invokeVoidMethod()
Date
makeDate()
String
multipleNew()
byte[][]
newVarArgs(byte[]... bytes)
int[]
newVarArgs(float myFloat, int... ints)
String[]
newVarArgs(String... strings)
Service[]
newVarArgs(Service... services)
byte[][]
newVarArgsWithMatchers()
String
newWithArguments(Service service, int times)
String
newWithWrongArguments(Service service, int times)
void
simpleMultipleNew()
void
simpleSingleNew()
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.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.
-
-
-
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
-
-