/*
 *
 * Copyright 2014, Armenak Grigoryan, and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */



package com.strider.datadefender.utils;

import org.apache.log4j.Logger;

import org.junit.Test;

import static org.apache.log4j.Logger.getLogger;

import junit.framework.TestCase;

/**
 *
 * @author strider
 */
public class XegerTest extends TestCase {
    private static final Logger log      = getLogger(XegerTest.class);
    private static final String REGEXP_1 = "[ab]{4,6}c";
    private static final String REGEXP_2 = "[0-9]{3}-[0-9]{3}-[0-9]{3}";

    public XegerTest(final String testName) {
        super(testName);
    }

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

    /**
     * Test of generate method, of class Xeger.
     */
    @Test
    public void testGenerate() {
        log.debug("Generate string");

        final Xeger instance = new Xeger(REGEXP_1);

        for (int i = 0; i < 100; i++) {
            final String text = instance.generate();

            assertTrue(text.matches(REGEXP_1));
        }
    }

    /**
     * Test of generate method, of class Xeger.
     */
    @Test
    public void testGenerateSIN() {
        log.debug("Generate SIN");

        final Xeger  instance = new Xeger(REGEXP_2);
        final String text     = instance.generate();

        log.debug(text);
        assertTrue(text.matches(REGEXP_2));
    }

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


//~ Formatted by Jindent --- http://www.jindent.com

@@ -1,727 +1,4 @@
-/*%0A *%0A * Copyright 2014, Armenak Grigoryan, and individual contributors as indicated%0A * by the @authors tag. See the copyright.txt in the distribution for a%0A * full listing of individual contributors.%0A *%0A * This is free software; you can redistribute it and/or modify it%0A * under the terms of the GNU Lesser General Public License as%0A * published by the Free Software Foundation; either version 2.1 of%0A * the License, or (at your option) any later version.%0A *%0A * This software is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%0A * Lesser General Public License for more details.%0A *%0A */%0A%0A%0A%0A
 pack
@@ -49,54 +49,32 @@
 org.
-apache.log4j.Logger;%0A%0Aimport org.jun
+junit.jup
 it
+er.api
 .Test;%0A
-%0A
 impo
@@ -91,71 +91,38 @@
 org.
-apache.log4j.Logger.getLogger;%0A%0Aimport junit.framework.TestCase
+junit.jupiter.api.Assertions.*
 ;%0A%0A/
@@ -177,97 +177,10 @@
 est 
-extends TestCase %7B%0A    private static final Logger log      = getLogger(XegerTest.class);
+%7B%0A
 %0A   
@@ -311,182 +311,8 @@
 %22;%0A%0A
-    public XegerTest(final String testName) %7B%0A        super(testName);%0A    %7D%0A%0A    @Override%0A    protected void tearDown() throws Exception %7B%0A        super.tearDown();%0A    %7D%0A%0A
     
@@ -418,33 +418,42 @@
 ) %7B%0A        
-log.debug
+System.out.println
 (%22Generate s
@@ -792,25 +792,34 @@
         
-log.debug
+System.out.println
 (%22Genera
@@ -948,17 +948,26 @@
     
-log.debug
+System.out.println
 (tex
@@ -1024,150 +1024,6 @@
   %7D%0A
-%0A    @Override%0A    protected void setUp() throws Exception %7B%0A        super.setUp();%0A    %7D%0A%7D%0A%0A%0A//~ Formatted by Jindent --- http://www.jindent.com
+%7D
 %0A

Fix Xeger test