// Path: test/org/sagebionetworks/bridge/TestConstants.java
// public static final StudyIdentifier TEST_STUDY = new StudyIdentifierImpl(TEST_STUDY_IDENTIFIER);


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.sagebionetworks.bridge.Roles.ADMIN;
import static org.sagebionetworks.bridge.Roles.DEVELOPER;
import static org.sagebionetworks.bridge.TestConstants.TEST_STUDY;
import static org.sagebionetworks.bridge.TestUtils.getNotificationTopic;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.sagebionetworks.bridge.TestUtils;
import org.sagebionetworks.bridge.config.BridgeConfig;
import org.sagebionetworks.bridge.config.Environment;
import org.sagebionetworks.bridge.exceptions.NotAuthenticatedException;
import org.sagebionetworks.bridge.json.BridgeObjectMapper;
import org.sagebionetworks.bridge.models.ResourceList;
import org.sagebionetworks.bridge.models.accounts.UserSession;
import org.sagebionetworks.bridge.models.notifications.NotificationMessage;
import org.sagebionetworks.bridge.models.notifications.NotificationTopic;
import org.sagebionetworks.bridge.models.notifications.SubscriptionRequest;
import org.sagebionetworks.bridge.services.NotificationTopicService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import play.mvc.Result;
import play.test.Helpers;
package org.sagebionetworks.bridge.play.controllers;






@RunWith(MockitoJUnitRunner.class)
public class NotificationTopicControllerTest {

    private static final String GUID = "DEF-GHI";

    @Spy
    private NotificationTopicController controller;

    @Mock
    private NotificationTopicService mockTopicService;
    
    @Mock
    private BridgeConfig mockBridgeConfig;

    @Mock
    private UserSession mockUserSession;
    
    @Captor
    private ArgumentCaptor<NotificationTopic> topicCaptor;

    @Captor
    private ArgumentCaptor<NotificationMessage> messageCaptor;
    
    @Captor
    private ArgumentCaptor<SubscriptionRequest> subRequestCaptor; 

    @Before
    public void before() throws Exception {
        this.controller.setNotificationTopicService(mockTopicService);
        controller.setBridgeConfig(mockBridgeConfig);
        
        doReturn(Environment.UAT).when(mockBridgeConfig).getEnvironment();

// Path: test/org/sagebionetworks/bridge/TestConstants.java
// public static final StudyIdentifier TEST_STUDY = new StudyIdentifierImpl(TEST_STUDY_IDENTIFIER);


// Path: test/org/sagebionetworks/bridge/play/controllers/NotificationTopicControllerTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.sagebionetworks.bridge.Roles.ADMIN;
import static org.sagebionetworks.bridge.Roles.DEVELOPER;
import static org.sagebionetworks.bridge.TestConstants.TEST_STUDY;
import static org.sagebionetworks.bridge.TestUtils.getNotificationTopic;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.sagebionetworks.bridge.TestUtils;
import org.sagebionetworks.bridge.config.BridgeConfig;
import org.sagebionetworks.bridge.config.Environment;
import org.sagebionetworks.bridge.exceptions.NotAuthenticatedException;
import org.sagebionetworks.bridge.json.BridgeObjectMapper;
import org.sagebionetworks.bridge.models.ResourceList;
import org.sagebionetworks.bridge.models.accounts.UserSession;
import org.sagebionetworks.bridge.models.notifications.NotificationMessage;
import org.sagebionetworks.bridge.models.notifications.NotificationTopic;
import org.sagebionetworks.bridge.models.notifications.SubscriptionRequest;
import org.sagebionetworks.bridge.services.NotificationTopicService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import play.mvc.Result;
import play.test.Helpers;

package org.sagebionetworks.bridge.play.controllers;






@RunWith(MockitoJUnitRunner.class)
public class NotificationTopicControllerTest {

    private static final String GUID = "DEF-GHI";

    @Spy
    private NotificationTopicController controller;

    @Mock
    private NotificationTopicService mockTopicService;
    
    @Mock
    private BridgeConfig mockBridgeConfig;

    @Mock
    private UserSession mockUserSession;
    
    @Captor
    private ArgumentCaptor<NotificationTopic> topicCaptor;

    @Captor
    private ArgumentCaptor<NotificationMessage> messageCaptor;
    
    @Captor
    private ArgumentCaptor<SubscriptionRequest> subRequestCaptor; 

    @Before
    public void before() throws Exception {
        this.controller.setNotificationTopicService(mockTopicService);
        controller.setBridgeConfig(mockBridgeConfig);
        
        doReturn(Environment.UAT).when(mockBridgeConfig).getEnvironment();

        doReturn(TEST_STUDY).when(mockUserSession).getStudyIdentifier();