Package hudson.plugins.growl.util

Source Code of hudson.plugins.growl.util.MessageTest

package hudson.plugins.growl.util;

import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import hudson.model.AbstractBuild;
import hudson.model.Project;
import hudson.model.Result;
import hudson.plugins.growl.GrowlPublisher.DescriptorImpl;
import hudson.plugins.growl.util.Message;

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

public class MessageTest {
  private DescriptorImpl descriptor;
  private AbstractBuild build;
  private String confirmation;
 
  @Before
  public void configure(){
    descriptor = new DescriptorImpl();
    descriptor.hudsonUrl = "http://localhost:8080/";
   
    Project project = mock(Project.class);
    when(project.getName()).thenReturn("ProjectName");

    build = mock(AbstractBuild.class);
    when(build.getProject()).thenReturn(project);
    when(build.getResult()).thenReturn(Result.SUCCESS);
    when(build.getUrl()).thenReturn("jobs/ProjectName");
    when(build.number).thenReturn(10);
   
   
    confirmation = String.format("Project: %s\nStatus: %s\nBuild Number: %d",
        "ProjectName", Result.SUCCESS.toString(), 10);
  }
 
  @Ignore
  @Test
  public void testCreateMessage() {
    Message message = new Message(build,descriptor);
    assertThat(message.getMessageText(), equalTo(confirmation));
    fail("Not yet implemented");
  }

}
TOP

Related Classes of hudson.plugins.growl.util.MessageTest

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.