package org.jenkinsci.backend.ircbot;

import java.io.IOException;
import java.io.InputStream;
import junit.framework.TestCase;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assume.assumeThat;
import org.jvnet.hudson.test.Issue;


/**
 *
 * @author Oleg Nenashev <o.v.nenashev@gmail.com>
 */
public class IrcBotBuildInfoTest extends TestCase {
    
    @Issue("INFRA-135")
    public void testVersionInfoStub() throws IOException {
        IrcBotBuildInfo info = IrcBotBuildInfo.readResourceFile("/versionInfo_test.properties");
        assertEquals("a", info.getBuildNumber());
        assertEquals("b", info.getBuildDate());
        assertEquals("c", info.getBuildID());
        assertEquals("d", info.getBuildURL());
        assertEquals("e", info.getGitCommit());
        System.out.println(info);
    }
    
    /**
     * Reads the real version info.
     * This test is expected to work in https://ci.jenkins-ci.org/job/infra_ircbot/ job only.
     * @throws IOException 
     */
    @Issue("INFRA-135")
    public void testVersionInfoReal() throws IOException {
        InputStream istream = IrcBotBuildInfo.class.getResourceAsStream("/versionInfo.properties");      
        assumeThat("This test is expected to work in https://ci.jenkins-ci.org/job/infra_ircbot/ job only", istream, not(nullValue())); 
        IrcBotBuildInfo info = IrcBotBuildInfo.readResourceFile("/versionInfo.properties");
        System.out.println(info);
    }
}

@@ -92,41 +92,8 @@
 am;%0A
-import junit.framework.TestCase;%0A
 impo
@@ -131,16 +131,61 @@
 hers.*;%0A
+import static org.junit.Assert.assertEquals;%0A
 import s
@@ -218,16 +218,40 @@
 umeThat;
+%0A%0Aimport org.junit.Test;
 %0Aimport 
@@ -379,31 +379,10 @@
 est 
-extends TestCase %7B%0A    
+%7B%0A
 %0A   
@@ -837,20 +837,16 @@
 ;%0A    %7D%0A
-    
 %0A    /**
@@ -1002,17 +1002,16 @@
 xception
- 
 %0A     */
@@ -1011,16 +1011,26 @@
      */%0A
+    @Test%0A
     @Iss
@@ -1203,22 +1203,16 @@
 rties%22);
-      
 %0A       
@@ -1339,17 +1339,16 @@
 lue()));
- 
 %0A       

Fix test failure locally