exercism / exercism/java-analyzer

LogLevels solution accused of hardcoding test data

Abierto
#271 5 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
13
Forks
27
Merge medio
4 d 9 h
PR fusionados (30 d)
6

Descripción

I wrote the following code for LogLevels:

`public class LogLevels {

public static String message(String logLine) {
int colonIdx = logLine.indexOf(":");
return logLine.substring(colonIdx + 1).trim();
}

public static String logLevel(String logLine) {
if (logLine.contains("INFO")) {
return "info";
} else if (logLine.contains("WARNING")) {
return "warning";
} else {
return "error";
}
}

public static String reformat(String logLine) {
return message(logLine) + " (" + logLevel(logLine) + ")";
}
}
`

However, the editor keeps saying that I've hardcoded test data. I think it might be because of the specific log level strings that I'm looking for, but what's wrong with that?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.