Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
move test app presenter creation to before method
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Apr 18, 2012
1 parent ed43a6b commit 8f16db3
Showing 1 changed file with 1 addition and 20 deletions.
Expand Up @@ -141,11 +141,8 @@ void beforeMethod()
resetAllCaptures();

setupDefaultMockExpectations();
}

private AppPresenter newAppPresenter()
{
return new AppPresenter(mockDisplay, mockEventBus, mockTranslationPresenter, mockDocumentListPresenter, mockSearchResultsPresenter, mockIdentity, mockWorkspaceContext, mockMessages, mockHistory, mockWindow, mockWindowLocation);
appPresenter = new AppPresenter(mockDisplay, mockEventBus, mockTranslationPresenter, mockDocumentListPresenter, mockSearchResultsPresenter, mockIdentity, mockWorkspaceContext, mockMessages, mockHistory, mockWindow, mockWindowLocation);
}

// Note: unable to test 'sign out' and 'close window' links as these have
Expand All @@ -168,7 +165,6 @@ public void testPerformsRequiredActionsOnBind()

replayAllMocks();

appPresenter = newAppPresenter();
appPresenter.bind();

verifyAllMocks();
Expand All @@ -177,7 +173,6 @@ public void testPerformsRequiredActionsOnBind()
public void testShowsNotificationEvents()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -204,7 +199,6 @@ public void testShowsNotificationEvents()
public void testShowsUpdatedProjectStats()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -226,7 +220,6 @@ public void testShowsUpdatedProjectStats()
public void testUpdateProjectStatsFromEditorView()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();
HistoryToken token = loadDocAndViewEditor();
Expand All @@ -244,7 +237,6 @@ public void testUpdateProjectStatsFromEditorView()
public void testHistoryTriggersDocumentSelectionEvent()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand Down Expand Up @@ -274,7 +266,6 @@ public void testHistoryTriggersDocumentSelectionEvent()
public void testHistoryTriggersViewChange()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand Down Expand Up @@ -306,7 +297,6 @@ public void testHistoryTriggersViewChange()
public void testNoEditorWithoutValidDocument()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -329,7 +319,6 @@ public void testNoEditorWithoutValidDocument()
public void testHistoryTriggersDocumentNameStatsUpdate()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand Down Expand Up @@ -366,7 +355,6 @@ public void testHistoryTriggersDocumentNameStatsUpdate()
public void testStatsAndNameChangeWithView()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -379,7 +367,6 @@ public void testStatsAndNameChangeWithView()
public void testShowsUpdatedDocumentStats()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -400,7 +387,6 @@ public void testShowsUpdatedDocumentStats()
public void testDoesNotShowWrongDocumentStats()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();
loadDocAndViewEditor();
Expand All @@ -420,7 +406,6 @@ public void testDoesNotShowWrongDocumentStats()
public void testUpdateDocumentStatsFromDoclistView()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();
HistoryToken token = loadDocAndViewEditor();
Expand All @@ -438,7 +423,6 @@ public void testUpdateDocumentStatsFromDoclistView()

public void testDismiss()
{
appPresenter = newAppPresenter();
String testMessage = "testing";

mockDisplay.setNotificationMessage(testMessage, Severity.Error);
Expand All @@ -461,7 +445,6 @@ public void testDismiss()
public void testDocumentsLinkGeneratesHistoryToken()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();
ClickEvent docLinkClickEvent = createMock(ClickEvent.class);
Expand Down Expand Up @@ -510,7 +493,6 @@ public void testDocumentsLinkGeneratesHistoryToken()
public void testSearchLinkGeneratesHistoryToken()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand All @@ -526,7 +508,6 @@ public void testSearchLinkGeneratesHistoryToken()
public void testShowsHidesReadonlyLabel()
{
replayAllMocks();
appPresenter = newAppPresenter();
appPresenter.bind();
verifyAllMocks();

Expand Down

0 comments on commit 8f16db3

Please sign in to comment.