Class: Blufin::ScannerJavaTests

Inherits:
YmlWriterBase show all
Defined in:
lib/core/code_scanners/scanner_java_tests.rb

Overview

This class scans ALL Java classes and generates blank tests for every class which doesn’t have a test. Also throws errors if ‘rogue’ tests exist and/or tests are named/placed incorrectly.

Constant Summary collapse

TEMPLATE =
<<TEMPLATE
package #{PLACEHOLDER_PACKAGE};

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@RunWith(MockitoJUnitRunner.class)
public class #{PLACEHOLDER_CLASS} {

    @Before
    public void setUp() {}

    @Test
    public void testSomething() {

        assertThat(true, is(true));
    }
}
TEMPLATE

Constants inherited from YmlWriterBase

YmlWriterBase::AUTO_TYPES, YmlWriterBase::PLACEHOLDER_CLASS, YmlWriterBase::PLACEHOLDER_IMPORT, YmlWriterBase::PLACEHOLDER_PACKAGE, YmlWriterBase::PLACEHOLDER_SCHEMA

Instance Method Summary collapse

Methods inherited from YmlWriterBase

#get_base_path, #get_java_path, #get_package, #get_package_from_file, #write_file_java

Constructor Details

#initialize(site, error_handler) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/core/code_scanners/scanner_java_tests.rb', line 33

def initialize(site, error_handler)

    @site                  = Blufin::SiteResolver::validate_site(site)
    @site_name             = Blufin::SiteResolver::get_site_name(@site)
    @site_name_camel_cased = Blufin::SiteResolver::get_site_name_camel_cased(@site)
    @site_path             = Blufin::SiteResolver::get_site_location(@site)
    @site_domain           = Blufin::SiteResolver::get_site_domain(@site)

    @error_handler = error_handler

    @infrastructure_classes = {}
    @infrastructure_tests   = {}

    scan_blufin
    scan_app_infrastructure

    tests_create_and_validate
    tests_rogue_check

end