Q:

What is the best approach to passing third party objects into constructor

I have a class that takes in an argument and then popluate a private hashmap from the argument. 
Public class Table {
  private Map<String, String> map = new HashMap<String, String>();
  private Workbook workbook;
  // approach 1
  Public Table(Workbook workbook) {
    this.workbook = workbook;
    // populate map using workbook
  }

  // approach 2
  Public Table(InputStream is) {
    this.workbook = WorkbookFactory.create(is)
    // Populate map
  }

 // approach 3
 Public Table(File file) {
   this.workbook = WorkbookFactory.create(file)
   // populate map
 }
}

Workbook is an Apache Poi Workbook. 
What would be the best approach with consideration to junit and mockito also. 
I'm leaning towards approach 1, because according to this, http://misko.hevery.com/code-reviewers-guide/flaw-constructor-does-real-work/ I should avoid new keyword in constructor.  But I don't want the client to have knowledge of Apache POI to use this class. 
Approach 2 and 3 are pretty similar.  With this I can pass in a file or input stream and not worry about the underlying implementation.  But mocking would be hard as I can't mock the workbook with this approach? 

A:

consider this:
public class Table {
  private Map<String, String> map = new HashMap<String, String>();
  private Workbook workbook;

  Table(Workbook workbook) {
    this.workbook = workbook;
    // populate map using workbook
  }

  public Table(InputStream is) {
       this(WorkbookFactory.create(is)) ;
  }

 public Table(File file) {
     this(new FileInputStream(file);
 }
}

note that the Workbook specific constructor is declared as package protected so normal clients won't be able to call it, but if your unit cases share the same package as your library, you'll have no problems calling that constructor directly from your unit test.   This would also allow you to write separate unit tests for the other two constructors.