X Tutup
package rx; import org.junit.Assert; import org.junit.Test; public class NotificationTest { @Test public void testOnNextIntegerNotificationDoesNotEqualNullNotification(){ final Notification integerNotification = Notification.createOnNext(1); final Notification nullNotification = Notification.createOnNext(null); Assert.assertFalse(integerNotification.equals(nullNotification)); } @Test public void testOnNextNullNotificationDoesNotEqualIntegerNotification(){ final Notification integerNotification = Notification.createOnNext(1); final Notification nullNotification = Notification.createOnNext(null); Assert.assertFalse(nullNotification.equals(integerNotification)); } @Test public void testOnNextIntegerNotificationsWhenEqual(){ final Notification integerNotification = Notification.createOnNext(1); final Notification integerNotification2 = Notification.createOnNext(1); Assert.assertTrue(integerNotification.equals(integerNotification2)); } @Test public void testOnNextIntegerNotificationsWhenNotEqual(){ final Notification integerNotification = Notification.createOnNext(1); final Notification integerNotification2 = Notification.createOnNext(2); Assert.assertFalse(integerNotification.equals(integerNotification2)); } @Test public void testOnErrorIntegerNotificationDoesNotEqualNullNotification(){ final Notification integerNotification = Notification.createOnError(new Exception()); final Notification nullNotification = Notification.createOnError(null); Assert.assertFalse(integerNotification.equals(nullNotification)); } @Test public void testOnErrorNullNotificationDoesNotEqualIntegerNotification(){ final Notification integerNotification = Notification.createOnError(new Exception()); final Notification nullNotification = Notification.createOnError(null); Assert.assertFalse(nullNotification.equals(integerNotification)); } @Test public void testOnErrorIntegerNotificationsWhenEqual(){ final Exception exception = new Exception(); final Notification onErrorNotification = Notification.createOnError(exception); final Notification onErrorNotification2 = Notification.createOnError(exception); Assert.assertTrue(onErrorNotification.equals(onErrorNotification2)); } @Test public void testOnErrorIntegerNotificationWhenNotEqual(){ final Notification onErrorNotification = Notification.createOnError(new Exception()); final Notification onErrorNotification2 = Notification.createOnError(new Exception()); Assert.assertFalse(onErrorNotification.equals(onErrorNotification2)); } }
X Tutup