Package reddit.response

Source Code of reddit.response.CommandResponseStrategyTest

package reddit.response;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import org.junit.Before;
import org.junit.Test;

import chatbot.client.Message;

public class CommandResponseStrategyTest {

  private static final String BOT_NAME = "Reddit";
 
  private CommandParameterResponseStrategy commandResponseStrategy;
 
  @Before
  public void setup() {
    this.commandResponseStrategy = new CommandParameterResponseStrategy(BOT_NAME);
  }
 
  @Test
  public void testOnlyBotNameMessageWithSubredditParameter() {
    Message message = new Message("User", BOT_NAME + " politics");
    assertThat(commandResponseStrategy.shouldRespond(message), is(true));
  }
 
  @Test
  public void testGivenEmptyMessage() {
    Message message = new Message("User", "");
    assertThat(commandResponseStrategy.shouldRespond(message), is(false));
  }
 
  @Test
  public void testParameterStringContent() {
    // TODO find out allowed letters in a subreddit name and apply that check
  }
}
TOP

Related Classes of reddit.response.CommandResponseStrategyTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.