|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdemo.org.powermock.examples.tutorial.domainmocking.impl.withoutpowermock.SampleServiceWithoutPowerMockImpl
public class SampleServiceWithoutPowerMockImpl
This is a simple service that delegates calls to two stub services. The purpose of this service is to demonstrate that need to refactor the production code in order to make it unit-testable if PowerMock is not used. Note that there's no need to refactor the class if PowerMock had been used.
Constructor Summary | |
---|---|
SampleServiceWithoutPowerMockImpl(PersonService personService,
EventService eventService)
Creates a new instance of the SampleServiceImpl with the following collaborators. |
Method Summary | |
---|---|
boolean |
createPerson(String firstName,
String lastName)
Create a new person based on the following parameters and store it in the underlying persistence store. |
protected BusinessMessages |
getNewBusinessMessagesInstance()
In order to test this class without PowerMock we need to create a new protected method whose only purpose is to create a new instance of a BusinessMessage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SampleServiceWithoutPowerMockImpl(PersonService personService, EventService eventService)
personService
- The person service to use.eventService
- The event service to use.Method Detail |
---|
public boolean createPerson(String firstName, String lastName)
createPerson
in interface SampleService
firstName
- The first name of the person to create.lastName
- The last name of the person to create.
true
if the person was created successfully,
false
otherwise.protected BusinessMessages getNewBusinessMessagesInstance()
BusinessMessages
object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |