<commit_before>/*******************************************************************************
 * Copyright (c) 2013 Actuate Corporation.
 * All rights reserved.
 *******************************************************************************/
package org.eclipse.birt.sdk;

import java.io.File;
import java.io.FilenameFilter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.junit.Assert;
import org.junit.Test;

/**
 * 
 */

public abstract class BaseTestTemplate
{
	
    protected Class mainClass;
    protected ClassLoader loader;
    
    @Test
    public void testMain( ) throws Exception
    {
        String output = "./target/output.html";
        new File( output ).delete( );
        int result = run( new String[]{"-o", output, "-m", "RunAndRender",
                "./target/birt-runtime/ReportEngine/samples/hello_world.rptdesign"} );
        Assert.assertEquals( 0, result );
        Assert.assertTrue( new File( output ).exists( ) );
        Assert.assertTrue( new String( Files.readAllBytes( Paths.get( output ) ), StandardCharsets.UTF_8 )
                .contains( "If you can see this report, it means that the BIRT viewer is installed correctly." ) );
    }

    @Test
    public void testTable( ) throws Exception
    {
        String output = "./target/table.html";
        new File( output ).delete( );
        int result = run( new String[]{"-o", output, "-m", "RunAndRender", "./src/test/resources/table.rptdesign"} );
        Assert.assertEquals( 0, result );
        Assert.assertTrue( new File( output ).exists( ) );
        //USA's customer count is 36<commit_msg>Updated unit test according to test report change<commit_after>/*******************************************************************************
 * Copyright (c) 2013 Actuate Corporation.
 * All rights reserved.
 *******************************************************************************/
package org.eclipse.birt.sdk;

import java.io.File;
import java.io.FilenameFilter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.junit.Assert;
import org.junit.Test;

/**
 * 
 */

public abstract class BaseTestTemplate
{
	
    protected Class mainClass;
    protected ClassLoader loader;
    
    @Test
    public void testMain( ) throws Exception
    {
        String output = "./target/output.html";
        new File( output ).delete( );
        int result = run( new String[]{"-o", output, "-m", "RunAndRender",
                "./target/birt-runtime/ReportEngine/samples/hello_world.rptdesign"} );
        Assert.assertEquals( 0, result );
        Assert.assertTrue( new File( output ).exists( ) );
        Assert.assertTrue( new String( Files.readAllBytes( Paths.get( output ) ), StandardCharsets.UTF_8 )
                .contains( "If you can see this report, it means that the BIRT Engine is installed correctly." ) );
    }

    @Test
    public void testTable( ) throws Exception
    {
        String output = "./target/table.html";
        new File( output ).delete( );
        int result = run( new String[]{"-o", output, "-m", "RunAndRender", "./src/test/resources/table.rptdesign"} );
        Assert.assertEquals( 0, result );
        Assert.assertTrue( new File( output ).exists( ) );
        //USA's customer count is 36
{'fraction_non_alphanumeric': 0.20498301245753114, 'fraction_numerical': 0.005096262740656852, 'mean_word_length': 3.2159904534606207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3233561', 'n_tokens_mistral': 967, 'n_tokens_neox': 921, 'n_words': 264}