package tech.tablesaw.join;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import tech.tablesaw.api.Table;

public class DataFrameJoinerTest {

  private static final Table OneYear = Table.read().csv(
      "Date,1 Yr Treasury Rate\n"
          + "\"Dec 1, 2017\",1.65%\n"
          + "\"Nov 1, 2017\",1.56%\n"
          + "\"Oct 1, 2017\",1.40%\n"
          + "\"Sep 1, 2017\",1.28%\n"
          + "\"Aug 1, 2017\",1.23%\n"
          + "\"Jul 1, 2017\",1.22%\n",
      "1 Yr Treasury Rate");
  
  private static final Table SP500 = Table.read().csv(
      "Date,S&P 500\n"
          + "\"Nov 1, 2017\",2579.36\n"
          + "\"Oct 1, 2017\",2521.20\n"
          + "\"Sep 1, 2017\",2474.42\n"
          + "\"Aug 1, 2017\",2477.10\n"
          + "\"Jul 1, 2017\",2431.39\n"
          + "\"Jun 1, 2017\",2430.06\n",
      "S&P 500");

  @Test
  public void innerJoin() {
    Table joined = SP500.join("Date").inner(OneYear, "Date");
    assertEquals(3, joined.columnCount());
    assertEquals(5, joined.rowCount());
  }
  
}

@@ -191,22 +191,23 @@
  Table O
-neYear
+NE_YEAR
  = Table
@@ -511,19 +511,17 @@
 Rate%22);%0A
-  
 %0A
+
   privat
@@ -935,14 +935,15 @@
 er(O
-neYear
+NE_YEAR
 , %22D
@@ -1036,13 +1036,11 @@
 ));%0A  %7D%0A
-  
 %0A%7D%0A

Improve variable naming