Skip to content

Commit 0418185

Browse files
author
James Bognar
committed
Unit tests
1 parent aa8f207 commit 0418185

230 files changed

Lines changed: 12754 additions & 371 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

juneau-bean/juneau-bean-atom/src/main/java/org/apache/juneau/bean/atom/AtomBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,5 @@ public static final Text text(String type) {
236236
/**
237237
* Constructor.
238238
*/
239-
protected AtomBuilder() {}
239+
protected AtomBuilder() {} // HTT - utility class; protected constructor exists only to allow subclassing
240240
}

juneau-bean/juneau-bean-common/src/main/java/org/apache/juneau/bean/LinkString.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ public LinkString setUri(String value, Object...args) {
163163
for (var i = 0; i < args.length; i++)
164164
try {
165165
args[i] = OpenApiSerializer.DEFAULT.getSession().serialize(HttpPartType.PATH, null, args[i]);
166-
} catch (SchemaValidationException | SerializeException e) {
167-
throw toRex(e);
166+
} catch (SchemaValidationException | SerializeException e) { // HTT - requires OpenApiSerializer to throw during default serialization
167+
throw toRex(e); // HTT
168168
}
169169
this.uri = java.net.URI.create(f(value, args));
170170
return this;

juneau-bean/juneau-bean-html5/src/main/java/org/apache/juneau/bean/html5/HtmlBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,5 +2209,5 @@ public static final Wbr wbr() {
22092209
/**
22102210
* Constructor.
22112211
*/
2212-
protected HtmlBuilder() {}
2212+
protected HtmlBuilder() {} // HTT - utility class; protected constructor exists only to allow subclassing
22132213
}

juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchema.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.juneau.bean.jsonschema;
1818

19+
import static org.apache.juneau.commons.utils.AssertionUtils.*;
1920
import static org.apache.juneau.commons.utils.CollectionUtils.*;
2021
import static org.apache.juneau.commons.utils.StringUtils.*;
2122
import static org.apache.juneau.commons.utils.ThrowableUtils.*;
@@ -2044,9 +2045,9 @@ private void setMasterOn(JsonSchema s) {
20442045
}
20452046

20462047
private void setMasterOn(JsonSchema[] ss) {
2047-
if (nn(ss))
2048-
for (var s : ss)
2049-
setMasterOn(s);
2048+
assertArgNotNull("ss", ss);
2049+
for (var s : ss)
2050+
setMasterOn(s);
20502051
}
20512052

20522053
private void setMasterOn(JsonSchemaArray ss) {

juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public JsonSchema load(URI uri) {
136136
if (r == null)
137137
return null;
138138
return Json5Parser.DEFAULT.parse(r, JsonSchema.class);
139-
} catch (Exception e) {
139+
} catch (Exception e) { // HTT - compiler-generated branch from try-with-resources null check
140140
throw toRex(e);
141141
}
142142
}

juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonType.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,8 @@ public static JsonType fromString(String value) {
6969
if (value == null || value.length() < 4)
7070
return null;
7171
var c = value.charAt(0);
72-
if (c == 'a') {
73-
if (value.equals("array"))
74-
return ARRAY;
75-
if (value.equals("any"))
76-
return ANY;
77-
}
72+
if (c == 'a' && value.equals("array"))
73+
return ARRAY;
7874
if (c == 'b' && value.equals("boolean"))
7975
return BOOLEAN;
8076
if (c == 'i' && value.equals("integer"))

juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Encoding.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ public Encoding(Encoding copyFrom) {
114114
this.style = copyFrom.style;
115115
this.explode = copyFrom.explode;
116116
this.allowReserved = copyFrom.allowReserved;
117-
if (nn(copyFrom.headers))
118-
headers.putAll(copyOf(copyFrom.headers, HeaderInfo::copy));
117+
headers.putAll(copyOf(copyFrom.headers, HeaderInfo::copy));
119118
}
120119

121120
/**

juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/HeaderInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public HeaderInfo(HeaderInfo copyFrom) {
130130
this.ref = copyFrom.ref;
131131
this.explode = copyFrom.explode;
132132
this.deprecated = copyFrom.deprecated;
133-
if (nn(copyFrom.examples))
134-
examples.putAll(copyOf(copyFrom.examples, Example::copy));
133+
examples.putAll(copyOf(copyFrom.examples, Example::copy));
135134
}
136135

137136
/**

juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Items.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ public Items(Items copyFrom) {
162162
this.uniqueItems = copyFrom.uniqueItems;
163163
this.items = copyFrom.items == null ? null : copyFrom.items.copy();
164164
this.default_ = copyFrom.default_;
165-
if (nn(copyFrom.enum_))
166-
this.enum_.addAll(copyOf(copyFrom.enum_));
165+
this.enum_.addAll(copyOf(copyFrom.enum_));
167166
this.ref = copyFrom.ref;
168167
}
169168

@@ -794,7 +793,7 @@ private Object resolveRefs(Object o, OpenApi openApi, Deque<String> refStack, in
794793
for (var e : o2.entrySet())
795794
e.setValue(resolveRefs(e.getValue(), openApi, refStack, maxDepth));
796795
}
797-
if (o instanceof JsonList o2)
796+
if (o instanceof JsonList o2) // HTT - requires JsonList-typed extra property for resolveRefs
798797
for (var li = o2.listIterator(); li.hasNext();)
799798
li.set(resolveRefs(li.next(), openApi, refStack, maxDepth));
800799
return o;

juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/Link.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ public Link(Link copyFrom) {
105105
this.operationId = copyFrom.operationId;
106106
this.requestBody = copyFrom.requestBody;
107107
this.server = copyFrom.server == null ? null : copyFrom.server.copy();
108-
if (nn(copyFrom.parameters))
109-
parameters.putAll(copyFrom.parameters);
108+
parameters.putAll(copyFrom.parameters);
110109
}
111110

112111
/**

0 commit comments

Comments
 (0)