Skip to content

Commit

Permalink
Java code improvement (#133)
Browse files Browse the repository at this point in the history
* More specific assertion error
* Add RunWith annotation to tests
  • Loading branch information
tushuhei authored Mar 17, 2023
1 parent 5221f63 commit 5d7a713
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion java/src/main/java/com/google/budoux/HTMLProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private HTMLProcessor() {}
String[] skipNodesStrings = gson.fromJson(reader, String[].class);
skipNodes = new HashSet<>(Arrays.asList(skipNodesStrings));
} catch (JsonSyntaxException | JsonIOException | IOException e) {
throw new RuntimeException(e);
throw new AssertionError(e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion java/src/main/java/com/google/budoux/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static Parser loadByFileName(String modelFileName) {
Map<String, Map<String, Integer>> model = gson.fromJson(reader, type);
return new Parser(model);
} catch (JsonIOException | JsonSyntaxException | IOException e) {
throw new RuntimeException(e);
throw new AssertionError(e);
}
}

Expand Down
3 changes: 3 additions & 0 deletions java/src/test/java/com/google/budoux/HTMLProcessorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link HTMLProcessor}. */
@RunWith(JUnit4.class)
public class HTMLProcessorTest {

@Test
Expand Down
3 changes: 3 additions & 0 deletions java/src/test/java/com/google/budoux/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link Parser}. */
@RunWith(JUnit4.class)
public class ParserTest {

@Test
Expand Down

0 comments on commit 5d7a713

Please sign in to comment.