Merge branch '1.5.x'

pull/8230/head
Stephane Nicoll 8 years ago
commit 5f2bd1667b

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -302,7 +302,8 @@ public final class ConditionMessage {
return new ConditionMessage(ConditionMessage.this, this.condition);
}
return new ConditionMessage(ConditionMessage.this,
this.condition + " " + reason);
this.condition + (StringUtils.isEmpty(this.condition) ? "" : " ")
+ reason);
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -117,6 +117,12 @@ public class ConditionMessageTests {
assertThat(message.toString()).isEqualTo("@Test OK");
}
@Test
public void forConditionShouldNotAddExtraSpaceWithEmptyCondition() throws Exception {
ConditionMessage message = ConditionMessage.forCondition("").because("OK");
assertThat(message.toString()).isEqualTo("OK");
}
@Test
public void forConditionWhenClassShouldIncludeCondition() throws Exception {
ConditionMessage message = ConditionMessage.forCondition(Test.class, "(a=b)")

Loading…
Cancel
Save