Skip to content

Commit

Permalink
Simple testing in GoogleTests
Browse files Browse the repository at this point in the history
  • Loading branch information
burnflare committed Nov 6, 2016
1 parent b6f0e44 commit f8f105d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/test/java/seedu/agendum/sync/SyncProviderGoogleTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package seedu.agendum.sync;

import org.junit.Before;
import org.junit.Test;
import seedu.agendum.model.task.Task;

import java.io.File;
import java.time.LocalDateTime;
import java.util.Optional;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static seedu.agendum.commons.core.Config.DEFAULT_DATA_DIR;

public class SyncProviderGoogleTests {
private SyncProviderGoogle syncProviderGoogle;
private static final File DATA_STORE_CREDENTIAL = new File(DEFAULT_DATA_DIR + "StoredCredential");

@Before
public void setUp() {
syncProviderGoogle = new SyncProviderGoogle();
}

@Test
public void addevent() {

This comment has been minimized.

Copy link
@INCENDE

INCENDE Nov 6, 2016

addEvent

This comment has been minimized.

Copy link
@burnflare

burnflare Nov 6, 2016

Author

All these names will be refactored to follow the 3 underscore format.

Task mockTask = mock(Task.class);
Optional<LocalDateTime> fakeTime = Optional.of(LocalDateTime.now());

when(mockTask.getStartDateTime()).thenReturn(fakeTime);
when(mockTask.getEndDateTime()).thenReturn(fakeTime);

syncProviderGoogle.addNewEvent(mockTask);
}

@Test
public void deleteEvent() {
Task mockTask = mock(Task.class);
Optional<LocalDateTime> fakeTime = Optional.of(LocalDateTime.now());

when(mockTask.getStartDateTime()).thenReturn(fakeTime);
when(mockTask.getEndDateTime()).thenReturn(fakeTime);

syncProviderGoogle.deleteEvent(mockTask);
}

}

0 comments on commit f8f105d

Please sign in to comment.