Package samples.expectnew
Class ExpectNewDemo
- java.lang.Object
-
- samples.expectnew.ExpectNewDemo
-
public class ExpectNewDemo extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private intdummyField
-
Constructor Summary
Constructors Constructor Description ExpectNewDemo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamalternativePath()TargetcreateTarget(ITarget target)booleanequals(java.lang.Object obj)booleanfileExists(java.lang.String name)voidfileWriter(java.lang.String name, java.lang.String msg)voidfileWriterPrint(java.lang.String name, java.lang.String msg)java.lang.StringgetMessage()java.lang.StringgetMessageWithArgument()private java.lang.StringgetTargetName(ITarget target)inthashCode()voidinvokeVoidMethod()java.util.DatemakeDate()java.lang.StringmultipleNew()byte[][]newSimpleVarArgs(byte[]... bytes)byte[][]newVarArgs(byte[]... bytes)int[]newVarArgs(float myFloat, int... ints)java.lang.String[]newVarArgs(java.lang.String... strings)Service[]newVarArgs(Service... services)byte[][]newVarArgsWithMatchers()java.lang.StringnewWithArguments(Service service, int times)java.lang.StringnewWithWrongArguments(Service service, int times)voidsimpleMultipleNew()private voidsimpleMultipleNewPrivate()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
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getMessage
public java.lang.String getMessage()
-
getMessageWithArgument
public java.lang.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 java.lang.String multipleNew()
-
simpleMultipleNew
public void simpleMultipleNew()
-
simpleMultipleNewPrivate
private void simpleMultipleNewPrivate()
-
simpleSingleNew
public void simpleSingleNew()
-
makeDate
public java.util.Date makeDate()
-
fileExists
public boolean fileExists(java.lang.String name)
-
alternativePath
public java.io.InputStream alternativePath()
-
newWithArguments
public java.lang.String newWithArguments(Service service, int times)
-
newWithWrongArguments
public java.lang.String newWithWrongArguments(Service service, int times)
-
newVarArgs
public java.lang.String[] newVarArgs(java.lang.String... strings)
-
newVarArgs
public int[] newVarArgs(float myFloat, int... ints)
-
newVarArgs
public byte[][] newVarArgs(byte[]... bytes)
-
newVarArgsWithMatchers
public byte[][] newVarArgsWithMatchers()
-
fileWriter
public void fileWriter(java.lang.String name, java.lang.String msg) throws java.io.IOException- Throws:
java.io.IOException
-
fileWriterPrint
public void fileWriterPrint(java.lang.String name, java.lang.String msg) throws java.io.IOException- Throws:
java.io.IOException
-
newSimpleVarArgs
public byte[][] newSimpleVarArgs(byte[]... bytes)
-
getTargetName
private java.lang.String getTargetName(ITarget target)
-
-