package com.codeborne.xlstest;

import org.junit.Test;

import java.io.File;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

public class InvalidXlsTest {
  @Test
  public void throwsX() {
    try {
      new XLS("This is not Excel file".getBytes());
      fail("expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {
      assertThat(e.getMessage(), is("Invalid XLS "));
      assertThat(e.getCause(), is(notNullValue()));
    }
  }

  @Test
  public void throwsX2() {
    try {
      new XLS(new File("missing-file.xls"));
      fail("expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {
      assertThat(e.getMessage(), is("Failed to read file missing-file.xls"));
      assertThat(e.getCause(), is(notNullValue()));
    }
  }
}

@@ -300,17 +300,69 @@
 d throws
-X
+_IllegalArgumentException_ifFailedToParseXlsFromBytes
 () %7B%0A   
@@ -504,32 +504,39 @@
 umentException e
+xpected
 ) %7B%0A      assert
@@ -533,32 +533,39 @@
     assertThat(e
+xpected
 .getMessage(), i
@@ -594,32 +594,39 @@
     assertThat(e
+xpected
 .getCause(), is(
@@ -686,10 +686,55 @@
 rows
-X2
+_IllegalArgumentException_ifFailedToReadXlsFile
 () %7B
@@ -881,16 +881,23 @@
 eption e
+xpected
 ) %7B%0A    
@@ -906,24 +906,31 @@
 assertThat(e
+xpected
 .getMessage(
@@ -995,16 +995,23 @@
 rtThat(e
+xpected
 .getCaus

rename test-methods