示例#1
0
/** Tests {@link Version}. */
@RunWith(JUnit4.class)
public class VersionTest {
  @Rule public final Std stdOut = Std.out();

  @Test
  public void whenInvoked_getVersion_returnsCurrentVersion() throws Exception {
    // run + assert
    assertThat(Version.getVersion()).contains("1.1.0");
  }

  @Test
  public void whenInvokedWithoutArguments_main_printsCurrentVersionToStdOut() throws Exception {
    // setup
    final String[] args = new String[0];
    // run
    Version.main(args);
    // assert
    assertThat(stdOut.getContent()).contains("1.1.0");
  }

  @Test
  public void whenInvokedWithArguments_main_printsProjectNameAndCurrentVersionToStdOut()
      throws Exception {
    // setup
    final String[] args = new String[] {"arg1"};
    // run
    Version.main(args);
    // assert
    assertThat(stdOut.getContent()).contains("tinybinding 1.1.0");
  }
}
示例#2
0
 @Test
 public void whenInvokedWithoutArguments_main_printsCurrentVersionToStdOut() throws Exception {
   // setup
   final String[] args = new String[0];
   // run
   Version.main(args);
   // assert
   assertThat(stdOut.getContent()).contains("1.1.0");
 }
示例#3
0
 @Test
 public void whenInvokedWithArguments_main_printsProjectNameAndCurrentVersionToStdOut()
     throws Exception {
   // setup
   final String[] args = new String[] {"arg1"};
   // run
   Version.main(args);
   // assert
   assertThat(stdOut.getContent()).contains("tinybinding 1.1.0");
 }