Package br.com.six2six.fixturefactory.function

Source Code of br.com.six2six.fixturefactory.function.CnpjFunctionTest

package br.com.six2six.fixturefactory.function;

import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;

import java.util.regex.Pattern;

import org.junit.Test;

import br.com.six2six.fixturefactory.function.impl.CnpjFunction;

public class CnpjFunctionTest {

  @Test
  public void randomCnpj() {
    String value = new CnpjFunction().generateValue();
    assertNotNull("Generated CNPJ can not be null", value);
    assertTrue("Invalid match for CNPJ", Pattern.matches("\\d{14}", value));
  }

  @Test
  public void randomFormattedCpf() {
    String value = new CnpjFunction(true).generateValue();
    assertNotNull("Generated formatted CNPJ can not be null", value);
    assertTrue("Invalid match for CNPJ", Pattern.matches("\\d{2}.\\d{3}.\\d{3}/\\d{4}-\\d{2}", value));
  }

 
}
TOP

Related Classes of br.com.six2six.fixturefactory.function.CnpjFunctionTest

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.