Skip to content

Commit

Permalink
Helbers comments
Browse files Browse the repository at this point in the history
Co-authored-by: Helber Belmiro <[email protected]>
  • Loading branch information
fjtirado and hbelmiro committed Aug 24, 2023
1 parent 80461c3 commit 92c7567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.kie.kogito.serverless.workflow.io.URIContentLoaderFactory;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import static org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils.DEFS_PREFIX;
Expand Down Expand Up @@ -56,7 +55,7 @@ public JsonSchema(ObjectNode node, Counter counter) {

private static String getId(JsonNode schemaContent, Counter counter) {
JsonNode title = schemaContent.get("title");
return title != null ? title.asText() + "_" + Integer.toString(counter.next()) : "nested_" + Integer.toString(counter.next());
return title != null ? title.asText() + "_" + counter.next() : "nested_" + counter.next();
}
}

Expand Down Expand Up @@ -88,7 +87,7 @@ private static JsonNode fillDefs(Map<String, JsonSchema> schemas) {

private static void replaceRefsWithDefs(JsonNode node, URI baseURI, Map<String, JsonSchema> schemas, Counter counter) {
if (node.isArray()) {
((ArrayNode) node).elements().forEachRemaining(n -> replaceRefsWithDefs(n, baseURI, schemas, counter));
node.elements().forEachRemaining(n -> replaceRefsWithDefs(n, baseURI, schemas, counter));
} else if (node.isObject()) {
ObjectNode objectNode = (ObjectNode) node;
JsonNode refNode = objectNode.get("$ref");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.kie.kogito.serverless.workflow.io;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -33,13 +32,13 @@
class URIContentLoaderTest {

@Test
void testExistingFile() throws IOException, URISyntaxException {
void testExistingFile() throws URISyntaxException {
assertThat(readString(builder(Thread.currentThread().getContextClassLoader().getResource("pepe.txt").toURI()))).isEqualTo("my name is javierito");
}

@Test
void testExistingClasspath() throws IOException {
assertThat(new String(readString(builder("classpath:pepe.txt")))).isEqualTo("my name is javierito");
void testExistingClasspath() {
assertThat(readString(builder("classpath:pepe.txt"))).isEqualTo("my name is javierito");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.kie.kogito.serverless.workflow.executor;

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;

Expand Down Expand Up @@ -57,7 +56,7 @@ static void cleanup() {
}

@Test
void openAPIInvocation() throws IOException, URISyntaxException {
void openAPIInvocation() throws IOException {
final double fahrenheit = 100;
final double difference = fahrenheit - 32.0;
final double product = difference * 0.5556;
Expand Down

0 comments on commit 92c7567

Please sign in to comment.