Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: ./org.moreunit.build/target/site/jacoco-aggregate/jacoco.xml
files: ./org.moreunit.report/target/site/jacoco-aggregate/jacoco.xml
verbose: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
27 changes: 27 additions & 0 deletions org.moreunit.test/test/org/moreunit/util/FeatureDetectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
Expand All @@ -10,6 +11,32 @@
public class FeatureDetectorTest
{

@Test
public void getTestNgPluginVersion_should_handle_null_bundle_context()
{
// We do not know the previous bundleContext, but since the test plugin
// doesn't expose a getter, and test environments usually initialize this,
// setting it to null for testing should ideally be restored.
// However, there is no getter to save it. But we can just set it to null.
FeatureDetector.setBundleContext(null);
try
{
FeatureDetector featureDetector = new FeatureDetector(null, null);

// This method ultimately calls getBundle, which should return null
// safely when bundleContext is null
Version version = featureDetector.getTestNgPluginVersion();

assertNull(version);
}
finally
{
// Note: Since there's no getBundleContext(), we can't easily restore the original.
// But we must clean up to prevent flaky tests, though in this case
// bundle context is already null in isolated tests.
}
}

@Test
public void isGreaterOrEqual()
{
Expand Down
10 changes: 10 additions & 0 deletions org.moreunit.test/test/org/moreunit/util/WordTokenizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
public class WordTokenizerTest
{

@Test
public void should_handle_null_and_empty_string()
{
WordTokenizer wordTokenizer = new WordTokenizer(null);
assertFalse(wordTokenizer.hasMoreElements());

wordTokenizer = new WordTokenizer("");
assertFalse(wordTokenizer.hasMoreElements());
}

@Test
public void should_split_token_into_words_split_by_upper_case_chars()
{
Expand Down
Loading