@Test
  public void testMeanScaledLocatorsHaveCorrectParameters() {
    BinaryLocatorSupplier supplier =
        new BinaryLocatorSupplier(data, DEFAULT_MASS_TYPE, DEFAULT_MASS_ARGS);
    Locator first_locator = supplier.popLocator();
    for (int i = 1; i < (int) (DEFAULT_MASS_ARGS[2] - DEFAULT_MASS_ARGS[1]); i++) {
      supplier.popLocator();
    }
    Locator second_locator = supplier.popLocator();

    first_locator.initialize();
    second_locator.initialize();
    BrightBodyList[] first_bodies = first_locator.locate();
    BrightBodyList[] second_bodies = second_locator.locate();

    Assert.assertTrue(first_bodies[0].size() > second_bodies[0].size());
    Assert.assertTrue(first_bodies[data.length / 2].size() > second_bodies[data.length / 2].size());
    Assert.assertTrue(first_bodies[data.length - 2].size() > second_bodies[data.length - 2].size());

    first_bodies[0].sortByArea();
    second_bodies[0].sortByArea();
    Assert.assertTrue(
        second_bodies[0].get(0).area / second_bodies[0].get(0).body.length
            > first_bodies[0].get(0).area / first_bodies[0].get(0).body.length);
  }
 @Test
 public void testMeanScaledSuppliesValidLocators() {
   BinaryLocatorSupplier supplier =
       new BinaryLocatorSupplier(data, DEFAULT_MASS_TYPE, DEFAULT_MASS_ARGS);
   while (!supplier.empty()) {
     Locator locator = supplier.popLocator();
     locator.initialize();
     BrightBodyList[] bodies = locator.locate();
     Assert.assertEquals(bodies.length, data.length); // checks length of the locators
     Assert.assertNotEquals(bodies[0].size(), 0); // tests that there is at least one body found
     Assert.assertNotEquals(
         bodies[data.length / 2].size(), 0); // tests that there is at least one body found
     Assert.assertNotEquals(
         bodies[data.length - 1].size(), 0); // tests that there is at least one body found
     Assert.assertTrue(
         bodies[data.length / 2].get(0).body.length
             > 5); // test that the first bright body is larger than 5
     Assert.assertTrue(
         bodies[data.length / 2].get(0).body.length
             < 1000); // test that the first bright body is smaller than 1000
     Assert.assertTrue(bodies[data.length / 2].get(0).area > 10);
     Assert.assertTrue(bodies[data.length / 2].get(0).area < Integer.MAX_VALUE);
   }
 }
  @Test
  public void testSingleRun() throws NullPointerException {
    BinaryLocatorSupplier supplier =
        new BinaryLocatorSupplier(data, DEFAULT_MASS_TYPE, DEFAULT_MASS_ARGS);
    Locator first = supplier.popLocator();
    first.initialize();
    BrightBodyList[] bodies_first = first.locate();
    Assert.assertNotNull(bodies_first);

    for (int i = 1; i < 6; i++) {
      supplier.popLocator();
    }

    Locator second = supplier.popLocator();
    second.initialize();
    BrightBodyList[] bodies_second = second.locate();
    Assert.assertNotNull(bodies_second);
  }