Q:

TestNG class with Factory and Dataprovider never works

I have a jar calculator library. I made a simple class to test 'sum' function with Factory and DataProvider like in many examples. But when i run it i see: no test's executed. If i delete Factory and write DataProvider to a Test annotation - everything works fine.
public class SumTest {

  Calculator calc = new Calculator();
  private final double a;
  private final double b;

  @Factory(dataProvider = "getValues")
  public SumTest(double aValue, double bValue) {
      this.a = aValue;
      this.b = bValue;
      this.calc = new Calculator();
  }

  @Test
  public void testSum() {
      Assert.assertEquals(a + b, calc.sum(a, b));
  }

  @DataProvider
  public Object[][] getValues() {
      return new Object[][]{
          {10, 5},
          {-10, 5},
          {11.55, -10.55},
          {-5, -6},
          {99999.8d, 1l},
          {9223372036854775807L, 9223372036854775807L}
      };
  }

}

A:

DataProvider needs to be Static to make Factory Work.

