/*
 * Copyright © 2016 <code@io7m.com> http://io7m.com
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

package com.io7m.jspatial.tests.implementation;

import com.io7m.jspatial.implementation.Subdivision;
import com.io7m.junreachable.UnreachableCodeException;
import org.hamcrest.core.Is;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public final class SubdivisionTest
{
  @Rule public final ExpectedException expected = ExpectedException.none();

  @Test
  public void testSubdivision1LTooSmall()
  {
    this.expected.expect(RuntimeException.class);
    Subdivision.subdivide1L(0L, 0L, new long[4]);
  }

  @Test
  public void testSubdivision1LArrayTooSmall()
  {
    this.expected.expect(RuntimeException.class);
    Subdivision.subdivide1L(0L, 0L, new long[2]);
  }

  @Test
  public void testSubdivision1DArrayTooSmall()
  {
    this.expected.expect(RuntimeException.class);
    Subdivision.subdivide1D(0.0, 0.0, new double[2]);
  }

  @Test
  public void testSubdivisionUnreachable()
    throws Exception
  {
    final Constructor<Subdivision> c =
      Subdivision.class.getDeclaredConstructor();
    c.setAccessible(true);

    this.expected.expect(InvocationTargetException.class);
    this.expected.expectCause(Is.isA(UnreachableCodeException.class));
    c.newInstance();
  }
}

@@ -971,16 +971,41 @@
 ore.Is;%0A
+import org.junit.Assert;%0A
 import o
@@ -1019,16 +1019,16 @@
 t.Rule;%0A
-
 import o
@@ -1440,24 +1440,43 @@
 w long%5B4%5D);%0A
+    Assert.fail();%0A
   %7D%0A%0A  @Test
@@ -1623,24 +1623,43 @@
 w long%5B2%5D);%0A
+    Assert.fail();%0A
   %7D%0A%0A  @Test
@@ -1814,16 +1814,35 @@
 le%5B2%5D);%0A
+    Assert.fail();%0A
   %7D%0A%0A  @
@@ -2161,16 +2161,16 @@
 lass));%0A
-
     c.ne
@@ -2178,18 +2178,37 @@
 Instance();%0A
+    Assert.fail();%0A
   %7D%0A%7D%0A

Add fail() calls for safety