}
private static IllegalStateException rethrow(Exception e) {
- // stacktrace is not helpful
- throw new WriterException("Fail to write JSON: " + e.getMessage());
+ throw new WriterException("Fail to write JSON", e);
}
@Nullable
package org.sonar.api.utils.text;
import com.google.common.collect.ImmutableMap;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.DateUtils;
-
import java.io.IOException;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.api.utils.DateUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
com.google.gson.stream.JsonWriter gson = mock(com.google.gson.stream.JsonWriter.class);
when(gson.beginArray()).thenThrow(new IOException("the reason"));
thrown.expect(WriterException.class);
- thrown.expectMessage("Fail to write JSON: the reason");
+ thrown.expectMessage("Fail to write JSON");
new JsonWriter(gson).beginArray();
}