public void testProxyForShouldFailIfProxyIdIsInvalid() throws Exception { try { wavelet.proxyFor("foo@gmail.com"); fail("Should have failed since proxy id is not encoded."); } catch (IllegalArgumentException e) { // Expected. } }
public void testProxyForShouldFailIfProxyIdIsInvalid() throws Exception { try { wavelet.proxyFor("foo@gmail.com"); fail("Should have failed since proxy id is not encoded."); } catch (IllegalArgumentException e) { // Expected. } }
public void testReply() throws Exception { assertEquals(1, wavelet.getBlips().size()); Blip replyBlip1 = mock(Blip.class); when(replyBlip1.getBlipId()).thenReturn("replyblip1"); Blip replyBlip2 = mock(Blip.class); when(replyBlip2.getBlipId()).thenReturn("replyblip2"); when(opQueue.appendBlipToWavelet(wavelet, "\n")).thenReturn(replyBlip1); when(opQueue.appendBlipToWavelet(wavelet, "\nFoo")).thenReturn(replyBlip2); try { wavelet.reply(null); fail("Should have failed when calling Wavelet.reply(null)."); } catch (IllegalArgumentException e) { // Expected. } try { wavelet.reply("Foo"); fail("Should have failed when calling Wavelet.reply(String) with arg that doesn't start " + "with a newline char."); } catch (IllegalArgumentException e) { // Expected. } Blip newBlip1 = wavelet.reply("\n"); Blip newBlip2 = wavelet.reply("\nFoo"); //operation must be submitted before it is added to wavelet, so should still be 1 assertEquals(1, wavelet.getBlips().size()); assertTrue(newBlip1.getBlipId().contains("replyblip1")); assertTrue(newBlip2.getBlipId().contains("replyblip2")); }
public void testReply() throws Exception { assertEquals(1, wavelet.getBlips().size()); Blip replyBlip1 = mock(Blip.class); when(replyBlip1.getBlipId()).thenReturn("replyblip1"); Blip replyBlip2 = mock(Blip.class); when(replyBlip2.getBlipId()).thenReturn("replyblip2"); when(opQueue.appendBlipToWavelet(wavelet, "\n")).thenReturn(replyBlip1); when(opQueue.appendBlipToWavelet(wavelet, "\nFoo")).thenReturn(replyBlip2); try { wavelet.reply(null); fail("Should have failed when calling Wavelet.reply(null)."); } catch (IllegalArgumentException e) { // Expected. } try { wavelet.reply("Foo"); fail("Should have failed when calling Wavelet.reply(String) with arg that doesn't start " + "with a newline char."); } catch (IllegalArgumentException e) { // Expected. } Blip newBlip1 = wavelet.reply("\n"); Blip newBlip2 = wavelet.reply("\nFoo"); //operation must be submitted before it is added to wavelet, so should still be 1 assertEquals(1, wavelet.getBlips().size()); assertTrue(newBlip1.getBlipId().contains("replyblip1")); assertTrue(newBlip2.getBlipId().contains("replyblip2")); }
public void testSetRobotAddress() throws Exception { assertNull(wavelet.getRobotAddress()); wavelet.setRobotAddress("foo@appspot.com"); assertEquals("foo@appspot.com", wavelet.getRobotAddress()); try { wavelet.setRobotAddress("bar@appspot.com"); fail("Should have failed when trying to call Wavelet.setRobotAddress() for the second time"); } catch (IllegalStateException e) { assertEquals("Robot address has been set previously to foo@appspot.com", e.getMessage()); } }
public void testSetRobotAddress() throws Exception { assertNull(wavelet.getRobotAddress()); wavelet.setRobotAddress("foo@appspot.com"); assertEquals("foo@appspot.com", wavelet.getRobotAddress()); try { wavelet.setRobotAddress("bar@appspot.com"); fail("Should have failed when trying to call Wavelet.setRobotAddress() for the second time"); } catch (IllegalStateException e) { assertEquals("Robot address has been set previously to foo@appspot.com", e.getMessage()); } }