Fix syntax and punctuation, and add test for connectivity warning format.
@@ -18,9 +18,9 @@ package com.google.devtools.build.lib.network;
public final class ConnectivityStatus {
/** Enumerates common connectivity statuses and their generic short warnings. */
public enum Status {
- NO_CREDENTIALS("No credentials."),
- NO_NETWORK("No internet connection."),
- NOT_REACHABLE("Service not reachable."),
+ NO_CREDENTIALS("No credentials"),
+ NO_NETWORK("No internet connection"),
+ NOT_REACHABLE("Service not reachable"),
OK("");
/** Generic warning associated with this status. */
@@ -37,9 +37,9 @@ public final class ConnectivityStatus {
/** Generic category type for this status, which contains a generic warning. */
public final Status status;
- /** Returns the complete formatted warning for this status. */
- public String fullWarning() {
- return status.shortWarning + " " + serviceInfo;
+ @Override
+ public String toString() {
+ return serviceInfo.isEmpty() ? status.shortWarning : status.shortWarning + ": " + serviceInfo;
}
/**
