@Test(expected = ValidationException.class) public void shouldNotCreateATweetBecauseLoginNull() { String login = null; String content = "content"; Tweet tweet = new Tweet(); tweet.setContent(content); tweet.setLogin(login); tweetRepository.createTweet(login, content); }
@Test(expected = ConstraintViolationException.class) public void shouldNotCreateATweetBecauseContentEmpty() { String login = "******"; String content = ""; Tweet tweet = new Tweet(); tweet.setContent(content); tweet.setLogin(login); tweetRepository.createTweet(login, content); }
@Test public void shouldCreateATweet() { String login = "******"; String content = "content"; Tweet tweet = new Tweet(); tweet.setContent(content); tweet.setLogin(login); assertThat(tweetRepository.createTweet(login, content), notNullValue()); }