package co.uk.real_logic.aeron.tools;

import org.apache.commons.cli.ParseException;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import uk.co.real_logic.aeron.tools.PubSubOptions;

/**
 * Created by bhorst on 3/3/15.
 */
public class PubSubOptionsTest
{
    PubSubOptions opts;
    @Before
    public void SetUp() {
        opts = new PubSubOptions();
    }

    @Test
    public void threadsShorthandValid() throws Exception {
        String[] args = { "-t", "1234" };
        opts.parseArgs(args);
        assertThat(opts.getThreads(), is(1234L));
    }

    @Test
    public void threadsLonghandValid() throws Exception {
        String[] args = { "--threads", "1234" };
        opts.parseArgs(args);
        assertThat(opts.getThreads(), is(1234L));
    }

    @Test (expected=ParseException.class)
    public void threadsInvalid() {

    }

    @Test (expected=ParseException.class)
    public void threadsLonghandInvalid() throws Exception {
        String[] args = { "--threads", "asdf" };
        opts.parseArgs(args);
    }
}

@@ -390,15 +390,19 @@
 oid 
-S
+s
 etUp()
+%0A   
  %7B%0A 
@@ -501,32 +501,36 @@
 throws Exception
+%0A   
  %7B%0A        Strin
@@ -702,32 +702,36 @@
 throws Exception
+%0A   
  %7B%0A        Strin
@@ -928,18 +928,110 @@
 valid() 
-%7B%0A
+throws Exception%0A    %7B%0A        String%5B%5D args = %7B %22-t%22, %22asdf%22 %7D;%0A        opts.parseArgs(args);
 %0A    %7D%0A%0A
@@ -1129,16 +1129,20 @@
 xception
+%0A   
  %7B%0A     

Fix the syntax of unit tests