テストランナーを作成しようとしています。最初のクラスはテストランナーで、2番目のクラスはtestetのクラスで、最後のクラスはメインページです。メソッド呼び出しでテスターメソッドに到達したいのですが、これは機能していません。
public class tester {
public tester()
{
}
@Test
public void testTopla(){
int sayi1 = 10;
int sayi2 = 20;
int gercekSonuc = 30;
//
islem isl = new islem(sayi1, sayi2);
int sonuc = isl.topla();
Assert.assertTrue("Sonucta Hata Var", sonuc == gercekSonuc);
}
and this is what i am testing
public class islem {
private int sayi1;
private int sayi2;
public islem(){
}
public islem(int sayi1, int sayi2){
this.sayi1 = sayi1;
this.sayi2 = sayi2;
}
public int getSayi1() {
return sayi1;
}
public void setSayi1(int sayi1) {
this.sayi1 = sayi1;
}
public int getSayi2() {
return sayi2;
}
public void setSayi2(int sayi2) {
this.sayi2 = sayi2;
}
public int topla(){
return this.sayi1 + this.sayi2;
}
and this
public class Deneme1UI extends UI {
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = Deneme1UI.class)
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Class hilmi = tester.class;
tester obj = new tester();
for(Method method : hilmi.getDeclaredMethods())
{
method.invoke(obj);
}