![]() |
![]() |
![]() |
![]() |
![]() |
|
Of course, while you are testing the RatingServer class, you
probably want to avoid the complexity of a complete application, so you
might define just a stub, such as ClientStub:
import java.rmi.*;
import java.math.*;
public class ClientStub {
public static void main(String args[]) {
// Construct a movie for testing
Movie movie = new Movie(2, 3, 8, "Psycho");
// Construct a rating server for testing
RatingServer ratingServer = new RatingServer();
// Test and print
int rating = ratingServer.serverRating(movie);
System.out.println("The server returned a rating of " + rating);
}
}
--- Result ---
RatingServer asked for a rating
The server returned a rating of 24