Skip to content

Commit

Permalink
Simplified some code
Browse files Browse the repository at this point in the history
  • Loading branch information
785172550 committed Sep 30, 2019
1 parent 9b90861 commit 97fa2ad
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ protected ContextLoader resolveContextLoader(Class<?> testClass,
}

private void addConfigAttributesClasses(ContextConfigurationAttributes configAttributes, Class<?>[] classes) {
List<Class<?>> combined = new ArrayList<>();
combined.addAll(Arrays.asList(classes));
List<Class<?>> combined = new ArrayList<>(Arrays.asList(classes));
if (configAttributes.getClasses() != null) {
combined.addAll(Arrays.asList(configAttributes.getClasses()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return true;
return obj != null && getClass() == obj.getClass();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ private void logDuplicateJsonObjectsWarning(List<URL> jsonObjects) {

@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
return true;
return obj != null && obj.getClass() == getClass();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ PrintStream getParent() {
}

private static PrintStream getSystemStream(PrintStream printStream) {
while (printStream instanceof PrintStreamCapture) {
if (printStream instanceof PrintStreamCapture) {
return ((PrintStreamCapture) printStream).getParent();
}
return printStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ private void registerTestRestTemplate(BeanDefinitionRegistry registry) {

@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
return true;
return obj != null && obj.getClass() == getClass();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public LocalHostWebClient(Environment environment) {

@Override
public <P extends Page> P getPage(String url)
throws IOException, FailingHttpStatusCodeException, MalformedURLException {
throws IOException, FailingHttpStatusCodeException {
if (url.startsWith("/")) {
String port = this.environment.getProperty("local.server.port", "8080");
url = "http://localhost:" + port + url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void beforeTestMethodShouldInjectMockBeanWhenDirtiesContextAttributeIsSet() thro
given(mockTestContext.getAttribute(DependencyInjectionTestExecutionListener.REINJECT_DEPENDENCIES_ATTRIBUTE))
.willReturn(Boolean.TRUE);
this.listener.beforeTestMethod(mockTestContext);
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance), (MockDefinition) any());
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance), any(MockDefinition.class));
assertThat(this.fieldCaptor.getValue().getName()).isEqualTo("mockBean");
}

Expand Down

0 comments on commit 97fa2ad

Please sign in to comment.