Skip to content

Commit

Permalink
remove unnecessary values unboxing
Browse files Browse the repository at this point in the history
  • Loading branch information
iampopovich committed Apr 17, 2024
1 parent 93f2606 commit 0f122f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void shouldBeAbleToRegisterALocalNode() throws URISyntaxException {
wait.until(obj -> distributor.getStatus().hasCapacity());

NodeStatus status = getOnlyElement(distributor.getStatus().getNodes());
assertEquals(1, getStereotypes(status).get(CAPS).intValue());
assertEquals(1, getStereotypes(status).get(CAPS));
}

@Test
Expand Down Expand Up @@ -192,7 +192,7 @@ void shouldBeAbleToRegisterACustomNode() throws URISyntaxException {
wait.until(obj -> distributor.getStatus().hasCapacity());

NodeStatus status = getOnlyElement(distributor.getStatus().getNodes());
assertEquals(1, getStereotypes(status).get(CAPS).intValue());
assertEquals(1, getStereotypes(status).get(CAPS));
}
}

Expand Down Expand Up @@ -231,7 +231,7 @@ void shouldBeAbleToRegisterNodesByListeningForEvents() throws URISyntaxException
wait.until(obj -> distributor.getStatus().hasCapacity());

NodeStatus status = getOnlyElement(distributor.getStatus().getNodes());
assertEquals(1, getStereotypes(status).get(CAPS).intValue());
assertEquals(1, getStereotypes(status).get(CAPS));
}
}

Expand Down Expand Up @@ -323,7 +323,7 @@ void distributorShouldUpdateStateOfExistingNodeWhenNodePublishesStateChange()
wait.until(obj -> distributor.getStatus().hasCapacity());

NodeStatus nodeStatus = getOnlyElement(distributor.getStatus().getNodes());
assertEquals(1, getStereotypes(nodeStatus).get(CAPS).intValue());
assertEquals(1, getStereotypes(nodeStatus).get(CAPS));

// Craft a status that makes it look like the node is busy, and post it on the bus.
NodeStatus status = node.getStatus();
Expand Down
2 changes: 1 addition & 1 deletion java/test/org/openqa/selenium/json/JsonOutputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void shouldConvertUnhandledAlertException() {
@Test
void shouldConvertDatesToMillisecondsInUtcTime() {
String jsonStr = convert(new Date(0));
assertThat(valueOf(jsonStr).intValue()).isZero();
assertThat(valueOf(jsonStr)).isZero();
}

@Test
Expand Down
10 changes: 5 additions & 5 deletions java/test/org/openqa/selenium/json/JsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void canHandleValueBeingAnArray() {

assertThat(response.getSessionId()).isEqualTo("bar");
assertThat(((List<?>) converted.getValue())).hasSize(2);
assertThat(response.getStatus().intValue()).isEqualTo(1512);
assertThat(response.getStatus()).isEqualTo(1512);
}

@Test
Expand Down Expand Up @@ -426,7 +426,7 @@ void decodingResponseWithNumbersInValueObject() {
void shouldRecognizeNumericStatus() {
Response response = new Json().toType("{\"status\":0,\"value\":\"cheese\"}", Response.class);

assertThat(response.getStatus().intValue()).isZero();
assertThat(response.getStatus()).isZero();
assertThat(response.getState()).isEqualTo(new ErrorCodes().toState(0));
String value = (String) response.getValue();
assertThat(value).isEqualTo("cheese");
Expand All @@ -437,7 +437,7 @@ void shouldRecognizeStringStatus() {
Response response =
new Json().toType("{\"status\":\"success\",\"value\":\"cheese\"}", Response.class);

assertThat(response.getStatus().intValue()).isZero();
assertThat(response.getStatus()).isZero();
assertThat(response.getState()).isEqualTo(new ErrorCodes().toState(0));
String value = (String) response.getValue();
assertThat(value).isEqualTo("cheese");
Expand All @@ -450,7 +450,7 @@ void shouldConvertInvalidSelectorError() {
.toType(
"{\"state\":\"invalid selector\",\"message\":\"invalid xpath selector\"}",
Response.class);
assertThat(response.getStatus().intValue()).isEqualTo(32);
assertThat(response.getStatus()).isEqualTo(32);
assertThat(response.getState()).isEqualTo(new ErrorCodes().toState(32));
}

Expand All @@ -459,7 +459,7 @@ void shouldRecognizeStringState() {
Response response =
new Json().toType("{\"state\":\"success\",\"value\":\"cheese\"}", Response.class);
assertThat(response.getState()).isEqualTo("success");
assertThat(response.getStatus().intValue()).isZero();
assertThat(response.getStatus()).isZero();
String value = (String) response.getValue();
assertThat(value).isEqualTo("cheese");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void shouldBeAbleToHandleGatewayTimeoutError() {

Response decoded = new W3CHttpResponseCodec().decode(response);

assertThat(decoded.getStatus().intValue()).isEqualTo(ErrorCodes.UNHANDLED_ERROR);
assertThat(decoded.getStatus()).isEqualTo(ErrorCodes.UNHANDLED_ERROR);
assertThat(decoded.getValue()).isEqualTo(responseString);
}

Expand All @@ -104,7 +104,7 @@ void shouldBeAbleToHandleBadGatewayError() {

Response decoded = new W3CHttpResponseCodec().decode(response);

assertThat(decoded.getStatus().intValue()).isEqualTo(ErrorCodes.UNHANDLED_ERROR);
assertThat(decoded.getStatus()).isEqualTo(ErrorCodes.UNHANDLED_ERROR);
assertThat(decoded.getValue()).isEqualTo(responseString);
}

Expand All @@ -120,7 +120,7 @@ void decodingAnErrorWithoutAStacktraceIsDecodedProperlyForNonCompliantImplementa
Response decoded = new W3CHttpResponseCodec().decode(response);

assertThat(decoded.getState()).isEqualTo("unsupported operation");
assertThat(decoded.getStatus().intValue()).isEqualTo(METHOD_NOT_ALLOWED);
assertThat(decoded.getStatus()).isEqualTo(METHOD_NOT_ALLOWED);

assertThat(decoded.getValue()).isInstanceOf(UnsupportedCommandException.class);
assertThat(((WebDriverException) decoded.getValue()).getMessage()).contains("I like peas");
Expand All @@ -140,7 +140,7 @@ void decodingAnErrorWithoutAStacktraceIsDecodedProperlyForConformingImplementati
Response decoded = new W3CHttpResponseCodec().decode(response);

assertThat(decoded.getState()).isEqualTo("unsupported operation");
assertThat(decoded.getStatus().intValue()).isEqualTo(METHOD_NOT_ALLOWED);
assertThat(decoded.getStatus()).isEqualTo(METHOD_NOT_ALLOWED);

assertThat(decoded.getValue()).isInstanceOf(UnsupportedCommandException.class);
assertThat(((WebDriverException) decoded.getValue()).getMessage()).contains("I like peas");
Expand Down

0 comments on commit 0f122f8

Please sign in to comment.