Jak mogę przetestować interfejs?
Chcę zrobić przypadek testowy JUnit dla interfejsu, ponieważ wiesz, że nie mogę utworzyć obiektu z interfejsu i nie chcę, aby jakiekolwiek nazwy klas pojawiły się w tym teście, chcę tylko przetestować interfejs i tylko używaj jego metod w teście.
Więc nie mogę utworzyć instancji obiektu takiego jak:
Interface obj = new Class();
ponieważ nie używam żadnych metod klas i nie chcę tworzyć instancji interfejsu jako:
Interface var = new Interface{//methods};
ponieważ nie chcę zastępować metod w teście.
AKTUALIZACJA:
i have an interface and a class which implements it:
public interface inter {
public void method1();
public void method2();
}
public class BlaBla implements inter{
@override
public void method1(){//stuff}
@override
public void method2(){//stuff}
}
Chcę przetestować BlaBla, ale zajmij się moim testem z interfejsem (inter).