Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.api.directions.v5.models;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.auto.value.AutoValue;
Expand Down Expand Up @@ -41,6 +42,7 @@ public static Builder builder() {
* @return a single snippet of the full text instruction
* @since 3.0.0
*/
@NonNull
public abstract String text();

/**
Expand All @@ -61,6 +63,7 @@ public static Builder builder() {
* @return String type from above list
* @since 3.0.0
*/
@NonNull
public abstract String type();

/**
Expand Down Expand Up @@ -205,7 +208,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
public abstract Builder text(String text);
public abstract Builder text(@NonNull String text);

/**
* String giving you more context about the component which may help in visual markup/display
Expand All @@ -227,7 +230,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
public abstract Builder type(String type);
public abstract Builder type(@NonNull String type);


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.api.directions.v5.models;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
Expand Down Expand Up @@ -45,7 +46,7 @@ public static Builder builder() {
* information to the user
* @since 3.0.0
*/
@Nullable
@NonNull
public abstract BannerText primary();

/**
Expand Down Expand Up @@ -132,7 +133,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
public abstract Builder primary(@Nullable BannerText primary);
public abstract Builder primary(@NonNull BannerText primary);

/**
* Ancillary visual information about the {@link LegStep}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.api.directions.v5.models;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.auto.value.AutoValue;
Expand Down Expand Up @@ -39,7 +40,7 @@ public static Builder builder() {
* @return plain text with all the {@link BannerComponents} text items combined
* @since 3.0.0
*/
@Nullable
@NonNull
public abstract String text();

/**
Expand Down Expand Up @@ -147,7 +148,7 @@ public abstract static class Builder {
* @since 3.0.0
*/
@Nullable
public abstract Builder text(String text);
public abstract Builder text(@NonNull String text);

/**
* A part or element of the {@link BannerInstructions}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public void sanity() throws Exception {
public void testSerializable() throws Exception {
BannerInstructions bannerInstructions = BannerInstructions.builder()
.distanceAlongGeometry(100d)
.primary(BannerText.builder().build())
.secondary(BannerText.builder().build())
.primary(BannerText.builder().text("Banner primary sample text").build())
.secondary(BannerText.builder().text("Banner secondary sample text").build())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If secondary is @Nullable, this is not needed right? I mean, passing a null value (as before) should work too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking in @Guardiola31337 . Looks like null is fine as a parameter.

Screen Shot 2019-04-10 at 2 01 08 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah and we'd be implicitly "testing" that secondary could be @Nullable, thanks for confirming @langsmith

.build();
byte[] serialized = TestUtils.serialize(bannerInstructions);
assertEquals(bannerInstructions, deserialize(serialized, BannerInstructions.class));
Expand Down