|
| 1 | +package rx; |
| 2 | + |
| 3 | +import org.junit.Assert; |
| 4 | +import org.junit.Test; |
| 5 | + |
| 6 | +public class NotificationTest { |
| 7 | + |
| 8 | + @Test |
| 9 | + public void testOnNextIntegerNotificationDoesNotEqualNullNotification(){ |
| 10 | + final Notification<Integer> integerNotification = Notification.createOnNext(1); |
| 11 | + final Notification<Integer> nullNotification = Notification.createOnNext(null); |
| 12 | + Assert.assertFalse(integerNotification.equals(nullNotification)); |
| 13 | + } |
| 14 | + |
| 15 | + @Test |
| 16 | + public void testOnNextNullNotificationDoesNotEqualIntegerNotification(){ |
| 17 | + final Notification<Integer> integerNotification = Notification.createOnNext(1); |
| 18 | + final Notification<Integer> nullNotification = Notification.createOnNext(null); |
| 19 | + Assert.assertFalse(nullNotification.equals(integerNotification)); |
| 20 | + } |
| 21 | + |
| 22 | + @Test |
| 23 | + public void testOnNextIntegerNotificationsWhenEqual(){ |
| 24 | + final Notification<Integer> integerNotification = Notification.createOnNext(1); |
| 25 | + final Notification<Integer> integerNotification2 = Notification.createOnNext(1); |
| 26 | + Assert.assertTrue(integerNotification.equals(integerNotification2)); |
| 27 | + } |
| 28 | + |
| 29 | + @Test |
| 30 | + public void testOnNextIntegerNotificationsWhenNotEqual(){ |
| 31 | + final Notification<Integer> integerNotification = Notification.createOnNext(1); |
| 32 | + final Notification<Integer> integerNotification2 = Notification.createOnNext(2); |
| 33 | + Assert.assertFalse(integerNotification.equals(integerNotification2)); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void testOnErrorIntegerNotificationDoesNotEqualNullNotification(){ |
| 38 | + final Notification<Integer> integerNotification = Notification.createOnError(new Exception()); |
| 39 | + final Notification<Integer> nullNotification = Notification.createOnError(null); |
| 40 | + Assert.assertFalse(integerNotification.equals(nullNotification)); |
| 41 | + } |
| 42 | + |
| 43 | + @Test |
| 44 | + public void testOnErrorNullNotificationDoesNotEqualIntegerNotification(){ |
| 45 | + final Notification<Integer> integerNotification = Notification.createOnError(new Exception()); |
| 46 | + final Notification<Integer> nullNotification = Notification.createOnError(null); |
| 47 | + Assert.assertFalse(nullNotification.equals(integerNotification)); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + public void testOnErrorIntegerNotificationsWhenEqual(){ |
| 52 | + final Exception exception = new Exception(); |
| 53 | + final Notification<Integer> onErrorNotification = Notification.createOnError(exception); |
| 54 | + final Notification<Integer> onErrorNotification2 = Notification.createOnError(exception); |
| 55 | + Assert.assertTrue(onErrorNotification.equals(onErrorNotification2)); |
| 56 | + } |
| 57 | + |
| 58 | + @Test |
| 59 | + public void testOnErrorIntegerNotificationWhenNotEqual(){ |
| 60 | + final Notification<Integer> onErrorNotification = Notification.createOnError(new Exception()); |
| 61 | + final Notification<Integer> onErrorNotification2 = Notification.createOnError(new Exception()); |
| 62 | + Assert.assertFalse(onErrorNotification.equals(onErrorNotification2)); |
| 63 | + } |
| 64 | +} |
0 commit comments