Skip to content

Commit

Permalink
#107 unnecessary exception throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 24, 2022
1 parent 8931be6 commit 8eddbd5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/xembly/Directive.java
Expand Up @@ -69,10 +69,8 @@ interface Stack {
/**
* Push cursor (runtime exception if stack is full).
* @param cursor Cursor to push
* @throws ImpossibleModificationException If fails
*/
void push(Directive.Cursor cursor)
throws ImpossibleModificationException;
void push(Directive.Cursor cursor);

/**
* Pop cursor (runtime exception if stack is empty).
Expand Down
11 changes: 5 additions & 6 deletions src/test/java/org/xembly/DirectivesTest.java
Expand Up @@ -73,7 +73,7 @@ public void makesXmlDocument() throws Exception {
}

@Test
public void parsesIncomingGrammar() throws Exception {
public void parsesIncomingGrammar() {
final Iterable<Directive> dirs = new Directives(
"XPATH '//orders[@id=\"152\"]'; SET 'test';"
);
Expand Down Expand Up @@ -127,7 +127,7 @@ public void addsMapOfValues() throws Exception {
}

@Test
public void ingoresEmptyInput() throws Exception {
public void ingoresEmptyInput() {
MatcherAssert.assertThat(
new Directives("\n\t \r"),
Matchers.emptyIterable()
Expand All @@ -137,7 +137,6 @@ public void ingoresEmptyInput() throws Exception {
@Test
public void performsFullScaleModifications() throws Exception {
final String script = new Directives()
// @checkstyle MultipleStringLiteralsCheck (1 line)
.add("html").attr("xmlns", "http://www.w3.org/1999/xhtml")
.add("body")
.add("p")
Expand Down Expand Up @@ -219,7 +218,7 @@ public void addsElementsCaseSensitively() throws Exception {
}

@Test
public void convertsToString() throws Exception {
public void convertsToString() {
final Directives dirs = new Directives();
for (int idx = 0; idx < Tv.TEN; ++idx) {
dirs.add("HELLO");
Expand Down Expand Up @@ -275,7 +274,7 @@ public void acceptsFromMultipleThreads() throws Exception {
new Callable<Void>() {
@Parallel(threads = Tv.FIFTY)
@Override
public Void call() throws Exception {
public Void call() {
dirs.append(
new Directives()
.add("fo9").attr("yu", "").set("some text 90")
Expand Down Expand Up @@ -304,7 +303,7 @@ public void addsComments() throws Exception {
}

@Test
public void appendsDirs() throws Exception {
public void appendsDirs() {
MatcherAssert.assertThat(
new Directives().add("0").append(
new Directives().add("1")
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/xembly/NsDirectiveTest.java
Expand Up @@ -41,7 +41,6 @@
/**
* Validates NsDirective class.
* @since 0.19.3
* @checkstyle MultipleStringLiteralsCheck (500 lines)
*/
public final class NsDirectiveTest {
@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/xembly/XemblerTest.java
Expand Up @@ -120,15 +120,15 @@ public void printsXmlDocument() throws Exception {
}

@Test
public void rendersXmlDeclaration() throws Exception {
public void rendersXmlDeclaration() {
MatcherAssert.assertThat(
new Xembler(new Directives("ADD 'f';")).xmlQuietly(),
Matchers.equalTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<f/>")
);
}

@Test
public void escapesBrokenText() throws Exception {
public void escapesBrokenText() {
MatcherAssert.assertThat(
Xembler.escape("привет hello \u0000"),
Matchers.equalTo("привет hello \\u0000")
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/xembly/prof/DirectivesProfTest.java
Expand Up @@ -45,7 +45,7 @@ public final class DirectivesProfTest {

@Test
@SuppressWarnings("PMD.InsufficientStringBufferDeclaration")
public void parsesLongProgram() throws Exception {
public void parsesLongProgram() {
final StringBuilder program = new StringBuilder(Tv.THOUSAND)
.append("ADD 'root';");
for (int idx = 0; idx < Tv.TEN * Tv.THOUSAND; ++idx) {
Expand Down

0 comments on commit 8eddbd5

Please sign in to comment.