Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RingerJK opened this issue Sep 5, 2022 · 0 comments
Open

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

RingerJK opened this issue Sep 5, 2022 · 0 comments

Comments

@RingerJK
Copy link
Contributor

RingerJK commented Sep 5, 2022

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);
}

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

No branches or pull requests

2 participants