Allora ragazzi sono dinuovo qui con un'altro grande problema....devo creare in eclipse un test con JUnit...allora ho un progetto Server e un progetto Client....
Il progetto Server contiene due classi la classe Server sarebbe L'interfaccia Remota e L'Implementazione :
codice:
public interface Server extends Remote {

	public int add(int a,int b) throws RemoteException;
	

}



public class ServerImpl extends UnicastRemoteObject implements Server,Serializable {

	
	public ServerImpl() throws RemoteException {
		super();
	}
	

	public int add(int a, int b) throws RemoteException {
		return a+b;
	}
	
	public static void main(String[] args) {
			int n=1099;
			try{
				LocateRegistry.createRegistry(n);
				ServerImpl s=new ServerImpl();
				Naming.rebind("ServerRemoto", s);
				
					System.out.println("Server avviato");
			       
				}
				catch(Exception e){e.printStackTrace();}
		}	
	}
come potete notare utilizzo RMI....Il progetto Client invece contiene altre due classi :Server e Client

codice:
public interface Server extends Remote {

	public int add(int a,int b) throws RemoteException;
	

}


public class Client {

	
		  public static void main(String[] arg) { 
			try 
		   	{ 
				Server obj =(Server) Naming.lookup("rmi://localhost/ServerRemoto");
		     	int risultato = obj.add(1,1); 
		     	//ResultSet rs=obj.getPietanze("ciao");
		     	
		     	System.out.println("1+1="+risultato);
	
		   	} 
		   	catch (Exception e)
		   	{ 
		   		e.printStackTrace(); 
		   	}
		  }
}
allora il prog funziona correttamente..ora il punto è cm faccio a creare un Test con JUnit???????
ho capito ke si deve fare New/JUnitCase Test scegliere il progetto il metodo da testare....e poi mandarlo in esecuzione...ma quale???prima il server prima il client????a me mi crea una nuova classe con dei metodi strani
LATO CLIENT:
codice:
public class test extends TestCase {

	public test(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public final void testMain() {
		fail("Not yet implemented"); // TODO
	}
LATO SERVER:
codice:
import junit.framework.TestCase;

public class prova extends TestCase {

	public prova(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public final void testAdd() {
		fail("Not yet implemented"); // TODO
	}
Ovviamente il mio test fallisce?????ma xke????...non riesco a capire cm funziona veramente aiutatemi .....grazie...