All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.eureka2.interest.TestInterestSubscriber Maven / Gradle / Ivy

The newest version!
package com.netflix.eureka2.interest;

import com.netflix.eureka2.interests.ChangeNotification;
import com.netflix.eureka2.interests.ChangeNotification.Kind;
import com.netflix.eureka2.registry.instance.InstanceInfo;
import com.netflix.eureka2.rx.ExtTestSubscriber;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

/**
 * Test subscriber for accessing and running assertions on {@link ChangeNotification} streams.
 *
 * @author Tomasz Bak
 */
public class TestInterestSubscriber extends ExtTestSubscriber> {

    @SafeVarargs
    public final void assertReceives(ChangeNotification... dataNotifications) {
        for (ChangeNotification n : dataNotifications) {
            assertThat(takeNextOrFail(), is(equalTo(n)));
        }
    }

    @SafeVarargs
    public final void assertReceivesBatch(ChangeNotification... dataNotifications) {
        assertReceives(dataNotifications);
        assertThat(takeNextOrFail().getKind(), is(equalTo(Kind.BufferSentinel)));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy