github.com/CyCoreSystems/ari@v4.8.4+incompatible/bus_test.go (about)

     1  package ari
     2  
     3  import "testing"
     4  
     5  func TestNullSubscription(t *testing.T) {
     6  
     7  	sub := NewNullSubscription()
     8  
     9  	select {
    10  	case <-sub.Events():
    11  		t.Error("received event from NullSubscription")
    12  	default:
    13  	}
    14  
    15  	sub.Cancel()
    16  
    17  	select {
    18  	case <-sub.Events():
    19  	default:
    20  		t.Error("NullSubscription failed to close")
    21  	}
    22  
    23  	// Make sure subsequent Cancel doesn't break
    24  	sub.Cancel()
    25  
    26  	select {
    27  	case <-sub.Events():
    28  	default:
    29  		t.Error("NullSubscription failed to close")
    30  	}
    31  
    32  }