Jump to content
DRS

Duvida JUNIT

Recommended Posts

DRS

Boas pessoal, estou a me preparar para um teste prático de faculdade e uma das perguntas é fazer um teste JUNIT na qual já fiz algumas básicas mas agora deparei-me com uma situação em que não sei o que fazer... Este projecto e respectiva classe esta a funcionar a 100% portanto o problema é só mesmo o teste.

Preciso de realizar um teste JUNIT que verifica a funcionalidade de registar um cliente da seguinte classe:

package rest.menu.manager.client;
import pt.utl.ist.po.ui.Command;
import pt.utl.ist.po.ui.Form;
import pt.utl.ist.po.ui.InputString;
import pt.utl.ist.po.ui.InvalidOperation;
import rest.textui.DuplicateKeyException;
import rest.textui.clients.MenuEntry;
import rest.textui.clients.Message;
import rest.core.*;
/**
 * This class implements the command that registers a client.
 *
 * @version 1.0
 * @author PO
 **/
public class RegisterClient extends Command<Outlet> {
   public RegisterClient(Outlet outlet) {
       super(false, MenuEntry.REGISTER_CLIENT, outlet);
   }

   /**
    * @see pt.utl.ist.po.ui.Command#execute()
    */
   @Override
   public void execute() throws InvalidOperation {
       Form f;
       InputString type;
       do {
           f = new Form();
           type = new InputString(f, Message.reqType());
           f.parse();
       } while(!(type.value().equals(Message.clientTypeOmnivorous()) || type.value().equals(Message.clientTypeVegetarian())));
       f = new Form();
       InputString name = new InputString(f, Message.reqName());
       InputString email = new InputString(f, Message.reqEmail());
       f.parse();
       new Client(name.value(), email.value(), type.value(), entity());
   }
}

A minha duvida esta principalmente em como testar o input de um user (InputString)... Agradeço quaisquer ajudas, obrigado!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.