From 8eddbd57ca44081e0368a3ae46defd7199ddf05c Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 24 Aug 2022 08:53:37 +0300 Subject: [PATCH] #107 unnecessary exception throwing --- src/main/java/org/xembly/Directive.java | 4 +--- src/test/java/org/xembly/DirectivesTest.java | 11 +++++------ src/test/java/org/xembly/NsDirectiveTest.java | 1 - src/test/java/org/xembly/XemblerTest.java | 4 ++-- src/test/java/org/xembly/prof/DirectivesProfTest.java | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/xembly/Directive.java b/src/main/java/org/xembly/Directive.java index c9e8668..14520f8 100644 --- a/src/main/java/org/xembly/Directive.java +++ b/src/main/java/org/xembly/Directive.java @@ -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). diff --git a/src/test/java/org/xembly/DirectivesTest.java b/src/test/java/org/xembly/DirectivesTest.java index 22c7ea0..a48f07e 100644 --- a/src/test/java/org/xembly/DirectivesTest.java +++ b/src/test/java/org/xembly/DirectivesTest.java @@ -73,7 +73,7 @@ public void makesXmlDocument() throws Exception { } @Test - public void parsesIncomingGrammar() throws Exception { + public void parsesIncomingGrammar() { final Iterable dirs = new Directives( "XPATH '//orders[@id=\"152\"]'; SET 'test';" ); @@ -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() @@ -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") @@ -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"); @@ -275,7 +274,7 @@ public void acceptsFromMultipleThreads() throws Exception { new Callable() { @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") @@ -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") diff --git a/src/test/java/org/xembly/NsDirectiveTest.java b/src/test/java/org/xembly/NsDirectiveTest.java index 92358ac..a3e0380 100644 --- a/src/test/java/org/xembly/NsDirectiveTest.java +++ b/src/test/java/org/xembly/NsDirectiveTest.java @@ -41,7 +41,6 @@ /** * Validates NsDirective class. * @since 0.19.3 - * @checkstyle MultipleStringLiteralsCheck (500 lines) */ public final class NsDirectiveTest { @Test diff --git a/src/test/java/org/xembly/XemblerTest.java b/src/test/java/org/xembly/XemblerTest.java index d0d751b..05fed53 100644 --- a/src/test/java/org/xembly/XemblerTest.java +++ b/src/test/java/org/xembly/XemblerTest.java @@ -120,7 +120,7 @@ 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("\n") @@ -128,7 +128,7 @@ public void rendersXmlDeclaration() throws Exception { } @Test - public void escapesBrokenText() throws Exception { + public void escapesBrokenText() { MatcherAssert.assertThat( Xembler.escape("привет hello \u0000"), Matchers.equalTo("привет hello \\u0000") diff --git a/src/test/java/org/xembly/prof/DirectivesProfTest.java b/src/test/java/org/xembly/prof/DirectivesProfTest.java index d1afcee..8beb178 100644 --- a/src/test/java/org/xembly/prof/DirectivesProfTest.java +++ b/src/test/java/org/xembly/prof/DirectivesProfTest.java @@ -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) {