Package com.notnoop.apns.internal

Source Code of com.notnoop.apns.internal.ApnsServiceImplTest

package com.notnoop.apns.internal;

import org.junit.Test;
import static org.mockito.Mockito.*;

import com.notnoop.apns.ApnsService;
import com.notnoop.apns.EnhancedApnsNotification;

public class ApnsServiceImplTest {

    EnhancedApnsNotification notification = new EnhancedApnsNotification(1,
            EnhancedApnsNotification.MAXIMUM_EXPIRY, "2342", "{}");

    @Test
    public void pushEventually() {
        ApnsConnection connection = mock(ApnsConnection.class);
        ApnsService service = newService(connection, null);

        service.push(notification);

        verify(connection, times(1)).sendMessage(notification);
    }

    @Test
    public void pushEventuallySample() {
        ApnsConnection connection = mock(ApnsConnection.class);
        ApnsService service = newService(connection, null);

        service.push("2342", "{}");

        verify(connection, times(1)).sendMessage(notification);
    }

    protected ApnsService newService(ApnsConnection connection, ApnsFeedbackConnection feedback) {
        return new ApnsServiceImpl(connection, null);
    }
}
TOP

Related Classes of com.notnoop.apns.internal.ApnsServiceImplTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.