Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toString for api models #8

Merged
merged 3 commits into from
Aug 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove unused import and tweak test for better grammar
XiongKezhi committed Aug 10, 2020
commit 2f1d4eb96d17e58dafc9ac9cb1af39399f63b11f
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

import java.util.Optional;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;

Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
import java.util.List;
import java.util.Optional;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ void shouldConstructCorrectly() {
assertThat(action.getDescription()).isPresent().hasValue("re-run the Jenkins build");
assertThat(action.getIdentifier()).isPresent().hasValue("re-run id");

assertThat(action.toString()).isEqualTo("ChecksAction{"
assertThat(action).hasToString("ChecksAction{"
+ "label='re-run', description='re-run the Jenkins build', identifier='re-run id'}");
}
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
import java.util.Optional;

import static io.jenkins.plugins.checks.api.ChecksAnnotationAssert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

class ChecksAnnotationTest {
private static final String PATH =
@@ -42,7 +41,7 @@ void shouldBuildCorrectlyWithAllFields() {
.hasTitle(Optional.of(TITLE))
.hasRawDetails(Optional.of(RAW_DETAILS));

assertThat(annotation.toString()).isEqualTo("ChecksAnnotation{"
assertThat(annotation).hasToString("ChecksAnnotation{"
+ "path='github-checks-api-plugin/src/main/java/io/jenkins/plugins/checks/CheckGHEventSubscriber.java'"
+ ", startLine=20, endLine=20, annotationLevel=NOTICE"
+ ", message='Avoid unused private fields such as 'LOGGER''"
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ void shouldBuildCorrectlyWithAllFields() {
.usingFieldByFieldElementComparator()
.containsExactlyElementsOf(actions);

assertThat(details.toString()).isEqualTo("ChecksDetails{"
assertThat(details).hasToString("ChecksDetails{"
+ "name='Jenkins', detailsURL='https://ci.jenkins.io', status=COMPLETED, conclusion=SUCCESS"
+ ", startedAt=2020-06-27T01:10, completedAt=2021-07-28T02:20"
+ ", output=" + output.toString()
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
import java.util.Optional;

import static io.jenkins.plugins.checks.api.ChecksImageAssert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

class ChecksImageTest {
@Test
@@ -19,7 +18,7 @@ void shouldConstructCorrectly() {
.hasImageUrl(Optional.of("https://ci.jenkins.io/job/Plugins/job/warnings-ng-plugin/job/master/"))
.hasCaption(Optional.of("charts generated by warning-ng-plugin"));

assertThat(image.toString()).isEqualTo("ChecksImage{"
assertThat(image).hasToString("ChecksImage{"
+ "alt='warnings-chart'"
+ ", imageUrl='https://ci.jenkins.io/job/Plugins/job/warnings-ng-plugin/job/master/'"
+ ", caption='charts generated by warning-ng-plugin'}");
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ void shouldBuildCorrectlyWithAllFields() {
.usingFieldByFieldElementComparator()
.containsExactlyInAnyOrderElementsOf(images);

assertThat(checksOutput.toString()).isEqualTo("ChecksOutput{"
assertThat(checksOutput).hasToString("ChecksOutput{"
+ "title='Coverage Report', summary='All code have been covered', text='# Markdown Supported Text'"
+ ", annotations=" + annotations
+ ", images=" + images