Package br.com.objectos.way.boleto

Source Code of br.com.objectos.way.boleto.TesteDeNumeroBancario

/*
* TesteDeNumeroBancario.java criado em 21/03/2013
*
* Propriedade de Objectos Fábrica de Software LTDA.
* Reprodução parcial ou total proibida.
*/
package br.com.objectos.way.boleto;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import org.testng.annotations.Test;

import br.com.objectos.way.boleto.NumeroBancario;

/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
@Test
public class TesteDeNumeroBancario {

  public void numero_com_digito() {
    String numero = "123-4";

    NumeroBancario res = new NumeroBancario(numero);

    assertThat(res.longValue(), equalTo(123l));
    assertThat(res.getDigito(), equalTo('4'));
  }

  public void numero_sem_digito() {
    String numero = "789";

    NumeroBancario res = new NumeroBancario(numero);

    assertThat(res.longValue(), equalTo(789l));
    assertThat(res.getDigito(), equalTo((char) 0));
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nao_numero() {
    String numero = "abc";

    new NumeroBancario(numero);
  }

}
TOP

Related Classes of br.com.objectos.way.boleto.TesteDeNumeroBancario

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.