Fix JUnit 4 to AssertJ migration bugs
The migration from JUnit 4 assertions to AssertJ assertions resulted in several unnecessary casts from int to long that actually cause assertions to pass when they should otherwise fail. This commit fixes all such bugs for the pattern `.isNotEqualTo((long)`.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,7 +58,7 @@ class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegrationTe
|
||||
URI uri = request.getURI();
|
||||
assertThat(uri.getScheme()).isEqualTo("http");
|
||||
assertThat(uri.getHost()).isNotNull();
|
||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
||||
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||
assertThat(request.getRemoteAddress()).isNotNull();
|
||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -95,7 +95,7 @@ class ServerHttpsRequestIntegrationTests {
|
||||
URI uri = request.getURI();
|
||||
assertThat(uri.getScheme()).isEqualTo("https");
|
||||
assertThat(uri.getHost()).isNotNull();
|
||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
||||
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||
assertThat(request.getRemoteAddress()).isNotNull();
|
||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
||||
|
||||
@@ -108,12 +108,11 @@ public class PathPatternParserTests {
|
||||
assertThat(pp2).isEqualTo(pp1);
|
||||
assertThat(pp2.hashCode()).isEqualTo(pp1.hashCode());
|
||||
assertThat(pp3).isNotEqualTo(pp1);
|
||||
assertThat(pp1.equals("abc")).isFalse();
|
||||
|
||||
pp1 = caseInsensitiveParser.parse("/abc");
|
||||
pp2 = caseSensitiveParser.parse("/abc");
|
||||
assertThat(pp1.equals(pp2)).isFalse();
|
||||
assertThat(pp2.hashCode()).isNotEqualTo((long) pp1.hashCode());
|
||||
assertThat(pp2.hashCode()).isNotEqualTo(pp1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user