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 int
dummyField
-
Constructor Summary
Constructors Constructor Description ExpectNewDemo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
alternativePath()
Target
createTarget(ITarget target)
boolean
equals(java.lang.Object obj)
boolean
fileExists(java.lang.String name)
void
fileWriter(java.lang.String name, java.lang.String msg)
void
fileWriterPrint(java.lang.String name, java.lang.String msg)
java.lang.String
getMessage()
java.lang.String
getMessageWithArgument()
private java.lang.String
getTargetName(ITarget target)
int
hashCode()
void
invokeVoidMethod()
java.util.Date
makeDate()
java.lang.String
multipleNew()
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.String
newWithArguments(Service service, int times)
java.lang.String
newWithWrongArguments(Service service, int times)
void
simpleMultipleNew()
private void
simpleMultipleNewPrivate()
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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in 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)
-
-