Por que não gerar JSON (ObjectMapper) no teste em vez de usar toString() do array de abrigos?
@Test
public void deveVerificarSeDispararRequisicaoGetSeraChamada() throws IOException, InterruptedException {
abrigo.setId(0L);
// Gera um JSON do array de abrigos
String json = new ObjectMapper().writeValueAsString(new Abrigo[]{ abrigo });
String expectedAbrigosCadastrados = "Abrigos cadastrados:";
String expectedIdENome = "0 - Teste";
// Captura stdout
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(baos);
System.setOut(printStream);
when(response.body()).thenReturn(json);
when(client.dispararRequisicaoGet(anyString())).thenReturn(response);
abrigoService.listarAbrigos();
String[] lines = baos.toString().split(System.lineSeparator());
String actualAbrigosCadastrados = lines[0];
String actualIdENome = lines[1];
Assertions.assertEquals(expectedAbrigosCadastrados, actualAbrigosCadastrados);
Assertions.assertEquals(expectedIdENome, actualIdENome);
}
}