Witam,
Mam takie dwie klasy, które po wrzuceniu do Eclipsa kompilują się elegancko:
public class Subscription {
private int price;
private int length;
public Subscription(int p, int n) {
price = p;
length = n;
}
public double pricePerMonth() {
double r = (double) price / (double) length;
return r;
}
public void cancel() {
length = 0;
}
}
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class SubscriptionTest {
@Test
public void test_returnEuro() {
System.out.println("Test if pricePerMonth returns Euro");
Subscription S = new Subscription(200, 2);
assertTrue(S.pricePerMonth() == 1.0);
}
@Test
public void test_roundUp() {
System.out.println("Test if pricePerMonth rounds up corrrectly...");
Subscription S = new Subscription(200, 3);
assertTrue(S.pricePerMonth() == 0.67);
}
}
Teraz jeśli chcę sobie skompilować z linii poleceń, w Linuxie:
$ javac -classpath ~/Testowy/JUnit.jar SubscriptionTest.java
Wyskakuje
SubscriptionTest.java:9: cannot find symbol
symbol : class Subscription
location: class SubscriptionTest
Subscription S = new Subscription(200, 2);
razy 4
Jak dodam po dwukropku ścieżkę do class, też nie działa. Klasa Subscription jest skompilowana, wszystko znajduje się w katalogu Testowy
Co robię źle?
Pozdr