public void testFailureBeforeOpenThrowsException() { try { channel.onFailure("for testing"); fail("Should not be able to receive onFailure without open call"); } catch (IllegalStateException expected) { // Expected. } }
public void testSuccessBeforeOpenThrowsException() { try { channel.onSuccess("for testing"); fail("Should not be able to receive onSuccess without open call"); } catch (IllegalStateException expected) { // Expected. } }
public void testSuccessBeforeOpenThrowsException() { try { channel.onSuccess("for testing"); fail("Should not be able to receive onSuccess without open call"); } catch (IllegalStateException expected) { // Expected. } }
public void testFailureBeforeOpenThrowsException() { try { channel.onFailure("for testing"); fail("Should not be able to receive onFailure without open call"); } catch (IllegalStateException expected) { // Expected. } }
/** * Tests that a channel fails if it receives a message before it is opened. */ public void testMessageBeforeOpenThrowsException() { try { channel.onUpdate(new FakeWaveViewServiceUpdate()); fail("Should not be able to receive update without open call"); } catch (IllegalStateException expected) { // Expected. } }
public void testOpenAfterOpenThrowsException() { open(); try { channel.open(null, null, null); fail("Should not be able to open again after open is called."); } catch (RuntimeException ex) { // Expected error. } }
public void testOpenAfterOpenThrowsException() { open(); try { channel.open(null, null, null); fail("Should not be able to open again after open is called."); } catch (RuntimeException ex) { // Expected error. } }
/** * Tests that a channel fails if it receives a message before it is opened. */ public void testMessageBeforeOpenThrowsException() { try { channel.onUpdate(new FakeWaveViewServiceUpdate()); fail("Should not be able to receive update without open call"); } catch (IllegalStateException expected) { // Expected. } }
public void testOpenAfterCloseThrowsIllegalStateException() { open(); close(); // Opening the channel again should fail. try { halfOpen(); fail("Should not be able to open a closed channel"); } catch (IllegalStateException ex) { // expect exception } }
public void testOpenAfterCloseThrowsIllegalStateException() { open(); close(); // Opening the channel again should fail. try { halfOpen(); fail("Should not be able to open a closed channel"); } catch (IllegalStateException ex) { // expect exception } }
public void testCannotCreateTooManyChannels() { ViewChannelImpl.setMaxViewChannelsPerWave(4); WaveId waveId = WaveId.of("example.com", "toomanywaveid"); for (int i = 0; i < 4; i++) { channel = new ViewChannelImpl(waveId, waveViewService, logger); } try { channel = new ViewChannelImpl(waveId, waveViewService, logger); fail("Should not be allowed to create any more view channels"); } catch (IllegalStateException ex) { // expected } }
public void testCannotCreateTooManyChannels() { ViewChannelImpl.setMaxViewChannelsPerWave(4); WaveId waveId = WaveId.of("example.com", "toomanywaveid"); for (int i = 0; i < 4; i++) { channel = new ViewChannelImpl(waveId, waveViewService, logger); } try { channel = new ViewChannelImpl(waveId, waveViewService, logger); fail("Should not be allowed to create any more view channels"); } catch (IllegalStateException ex) { // expected } }
public void testSubmitDeltaOnClosedChannelThrowsIllegalStateException() { open(); close(); // submit a delta should fail try { channel.submitDelta(WAVELET_ID, emptyDelta(), new MockSubmitListener()); fail("Should not be able to submit on a closed channel"); } catch (IllegalStateException ex) { // expect exception } }
public void testSubmitDeltaOnClosedChannelThrowsIllegalStateException() { open(); close(); // submit a delta should fail try { channel.submitDelta(WAVELET_ID, emptyDelta(), new MockSubmitListener()); fail("Should not be able to submit on a closed channel"); } catch (IllegalStateException ex) { // expect exception } }