def test_no_entry_point_found(self): path = Path('.') # Doesn't matter what it is. process = FakeProcess( None, get_test_path('java/javap/one-class-no-main.txt'), check_args=False) with FakeProcessContext(process): with pytest.raises(ValueError) as info: _find_entry_point(path, None) assert info.value.args[ 0] == 'No entry point found for the application.'
def test_specified_entry_point_not_found_one_discovered(self): path = Path('.') # Doesn't matter what it is. process = FakeProcess( None, get_test_path('java/javap/one-class-with-main.txt'), check_args=False) with FakeProcessContext(process): with pytest.raises(ValueError) as info: _find_entry_point(path, 'com.bad.EntryPoint') assert info.value.args[ 0] == 'Specified entry point com.bad.EntryPoint not found in compiled classes.'
def test_too_many_entry_points_found(self): path = Path('.') # Doesn't matter what it is. process = FakeProcess( None, get_test_path('java/javap/many-classes-multi-mains.txt'), check_args=False) with FakeProcessContext(process): with pytest.raises(ValueError) as info: _find_entry_point(path, None) assert info.value.args[0] == 'Too many entry points found: com.example.ui.UIUtils, com.example.App. You ' \ 'will need to specify one.'
def test_one_entry_point_found(self): path = Path('.') # Doesn't matter what it is. process = FakeProcess( None, get_test_path('java/javap/one-class-with-main.txt'), check_args=False) with FakeProcessContext(process): assert _find_entry_point(path, None) == 'com.example.ui.UIUtils'
def test_specified_entry_point_matches_many_discovered(self): path = Path('.') # Doesn't matter what it is. process = FakeProcess( None, get_test_path('java/javap/many-classes-multi-mains.txt'), check_args=False) with FakeProcessContext(process): assert _find_entry_point(path, 'com.example.App') == 'com.example.App'