Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Evgeny Mandrikov <138671+Godin@users.noreply.github.com>
  • Loading branch information
marchof and Godin committed Feb 3, 2022
1 parent 9e736bf commit f9e49cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.jacoco.agent.rt.internal;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -214,11 +215,15 @@ public void testTransformFailure() {
protectionDomain, null);
fail("IllegalClassFormatException expected.");
} catch (IllegalClassFormatException e) {
assertTrue(e.getMessage(), e.getMessage()
.startsWith("Error while instrumenting org.jacoco.Sample"));
assertEquals(String.format(
"Error while instrumenting %s with JaCoCo %s/%s.",
"org.jacoco.Sample", JaCoCo.VERSION, JaCoCo.COMMITID_SHORT),
e.getMessage());
}
recorder.assertException(IllegalClassFormatException.class,
"Error while instrumenting org.jacoco.Sample",
String.format("Error while instrumenting %s with JaCoCo %s/%s.",
"org.jacoco.Sample", JaCoCo.VERSION,
JaCoCo.COMMITID_SHORT),
IOException.class);
recorder.clear();
}
Expand Down
Expand Up @@ -14,7 +14,6 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
* {@link IExceptionLogger} implementation for testing purposes.
Expand Down Expand Up @@ -51,7 +50,7 @@ public void assertException(final Class<? extends Throwable> exceptionType,
public void assertException(final Class<? extends Throwable> exceptionType,
final String message, final Class<? extends Throwable> causeType) {
assertEquals(exceptionType, this.exceptionType);
assertTrue(this.message, this.message.startsWith(message));
assertEquals(message, this.message);
assertEquals(causeType, this.causeType);
}

Expand Down
2 changes: 1 addition & 1 deletion org.jacoco.core/src/org/jacoco/core/JaCoCo.java
Expand Up @@ -19,7 +19,7 @@
*/
public final class JaCoCo {

/** Version of JaCoCo core. */
/** Qualified version of JaCoCo core. */
public static final String VERSION;

/** Commit ID of the source tree of JaCoCo core. */
Expand Down

0 comments on commit f9e49cf

Please sign in to comment.