* upgrade to spring boot 1.5.2 * add full update to REST API * modify ratings controller * upgrade herold * fix integration test * fix integration test * minor fix * fix integration test * fix integration test * minor cleanup * minor cleanup * remove log4j properties * use standard logbook.xml * remove log4j dependencies * remove commons-logging * merge * fix conflict * exclude commons-logging dependency * cleanup * minor fix * minor fix * fix dependency issues * Revert "fix dependency issues" This reverts commit 83bf1f9fd2e1a9a55f9cacb085669568b06b49ec. * fix dependency issues * minor fix * minor fix * minor fix * cleanup generated files * fix commons-logging issue * add parent to pom * cleanup parent dependencies * cleanup pom * cleanup pom * add missing parent * fix logging issue * fix test names
41 lines
1002 B
Java
41 lines
1002 B
Java
package com.baeldung;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.junit.Test;
|
|
|
|
import twitter4j.TwitterException;
|
|
|
|
public class ApplicationIntegrationTest {
|
|
|
|
/**
|
|
* In order run this jUnit test you need to configure your API details in the twitter4j.properties
|
|
*/
|
|
|
|
String tweet = "baeldung is awsome";
|
|
|
|
@Test
|
|
public void givenText_updateStatus() throws TwitterException {
|
|
String text = Application.createTweet(tweet);
|
|
assertEquals(tweet, text);
|
|
}
|
|
|
|
@Test
|
|
public void givenCredential_fetchStatus() throws TwitterException {
|
|
List<String> statuses = Application.getTimeLine();
|
|
List<String> expectedStatuses = new ArrayList<String>();
|
|
expectedStatuses.add(tweet);
|
|
assertEquals(expectedStatuses, statuses);
|
|
}
|
|
|
|
@Test
|
|
public void givenRecipientNameAndMessage_sendDirectMessage() throws TwitterException {
|
|
String msg = Application.sendDirectMessage("YOUR_RECCIPIENT_ID", tweet);
|
|
assertEquals(msg, tweet);
|
|
}
|
|
|
|
}
|