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 2bd5a8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 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

0 comments on commit 2bd5a8f

Please sign in to comment.