Skip to content

Commit

Permalink
test sync on too
Browse files Browse the repository at this point in the history
  • Loading branch information
burnflare committed Nov 6, 2016
1 parent a5c980a commit df90680
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/test/java/seedu/agendum/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import seedu.agendum.model.ReadOnlyToDoList;
import seedu.agendum.model.task.*;
import seedu.agendum.storage.XmlToDoListStorage;
import seedu.agendum.sync.SyncProviderGoogleTests;
import seedu.agendum.testutil.EventsCollector;

import java.io.File;
Expand Down Expand Up @@ -416,6 +417,13 @@ public void execute_delete_removesCorrectMultipleTasks() throws Exception {
}
//@author

@Test
public void execute_syncOn_successfull() throws Exception {
SyncProviderGoogleTests.copyTestCredentials();
assertCommandBehavior("sync on",
SyncCommand.SYNC_ON_MESSAGE);
}

@Test
public void execute_syncOff_successfull() throws Exception {
assertCommandBehavior("sync off",
Expand Down
13 changes: 9 additions & 4 deletions src/test/java/seedu/agendum/sync/SyncProviderGoogleTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ public class SyncProviderGoogleTests {

@Before
public void setUp() {
copyTestCredentials();

mockSyncManager = mock(SyncManager.class);
syncProviderGoogle = spy(new SyncProviderGoogle());
syncProviderGoogle.setManager(mockSyncManager);
}

public static void copyTestCredentials() {
try {
DATA_STORE_CREDENTIAL.delete();
Files.copy(DATA_STORE_CREDENTIAL_TEST.toPath(), DATA_STORE_CREDENTIAL.toPath());
} catch (IOException e) {
e.printStackTrace();
}

mockSyncManager = mock(SyncManager.class);
syncProviderGoogle = spy(new SyncProviderGoogle());
syncProviderGoogle.setManager(mockSyncManager);
}

@After
Expand Down

0 comments on commit df90680

Please sign in to comment.