Skip to content

[Tests] Add more unit tests for services-core module #1491

Description

@RingerJK

Have to review mapbox-java services-core module and add unit tests where required

Samples of code without unit tests:

public final class MapboxUtils {
private MapboxUtils() {
// Empty private constructor since only static methods are found inside class.
}
/**
* Checks that the provided access token is not empty or null, and that it starts with
* the right prefixes. Note that this method does not check Mapbox servers to verify that
* it actually belongs to an account.
*
* @param accessToken A Mapbox access token.
* @return true if the provided access token is valid, false otherwise.
* @since 1.0.0
*/
public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
}
}

public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.format(coordinate);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions