#310 - Polishing.

Add linebreak to commit message only if detail is present.
This commit is contained in:
Mark Paluch
2020-04-29 17:07:41 +02:00
parent 8e755da1b3
commit 49adb1da2d
2 changed files with 54 additions and 2 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.release.git;
import static org.assertj.core.api.Assertions.*;
import java.util.Optional;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.data.release.issues.Ticket;
import org.springframework.data.release.issues.TicketStatus;
/**
* @author Mark Paluch
*/
public class CommitUnitTests {
@Test
public void shouldRenderCommitMessage() {
assertThat(new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.empty()))
.hasToString("1234 - Summary.");
}
@Test
public void shouldRenderCommitMessageWithDetail() {
assertThat(
new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.of("detail")))
.hasToString("1234 - Summary.\n" + "\n" + "detail");
}
}