Ensuring consistency of nullable mainImage in recipe views and tests.
This commit is contained in:
parent
c163e8ee1d
commit
0d86ab6d93
@ -147,6 +147,7 @@ public class RecipeControllerTests {
|
||||
.andExpect(jsonPath("$.recipe.starCount").value(0))
|
||||
.andExpect(jsonPath("$.recipe.viewerCount").value(0))
|
||||
.andExpect(jsonPath("$.recipe.isPublic").value(true))
|
||||
.andExpect(jsonPath("$.recipe.mainImage").value(nullValue()))
|
||||
.andExpect(jsonPath("$.isStarred").value(nullValue()))
|
||||
.andExpect(jsonPath("$.isOwner").value(nullValue()));
|
||||
}
|
||||
@ -218,7 +219,8 @@ public class RecipeControllerTests {
|
||||
.andExpect(jsonPath("$.content[0].owner.id").value(owner.getId()))
|
||||
.andExpect(jsonPath("$.content[0].owner.username").value(owner.getUsername()))
|
||||
.andExpect(jsonPath("$.content[0].isPublic").value(true))
|
||||
.andExpect(jsonPath("$.content[0].starCount").value(0));
|
||||
.andExpect(jsonPath("$.content[0].starCount").value(0))
|
||||
.andExpect(jsonPath("$.content[0].mainImage").value(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -277,6 +279,7 @@ public class RecipeControllerTests {
|
||||
.andExpect(jsonPath("$.recipe.starCount").value(0))
|
||||
.andExpect(jsonPath("$.recipe.viewerCount").value(0))
|
||||
.andExpect(jsonPath("$.recipe.isPublic").value(true))
|
||||
.andExpect(jsonPath("$.recipe.mainImage").value(nullValue()))
|
||||
.andExpect(jsonPath("$.isStarred").value(false))
|
||||
.andExpect(jsonPath("$.isOwner").value(true));
|
||||
}
|
||||
|
@ -24,5 +24,5 @@ public interface Recipe {
|
||||
boolean isPublic();
|
||||
Set<User> getViewers();
|
||||
Set<RecipeComment> getComments();
|
||||
Image getMainImage();
|
||||
@Nullable Image getMainImage();
|
||||
}
|
||||
|
@ -224,11 +224,11 @@ public final class RecipeEntity implements Recipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public S3ImageEntity getMainImage() {
|
||||
public @Nullable S3ImageEntity getMainImage() {
|
||||
return this.mainImage;
|
||||
}
|
||||
|
||||
public void setMainImage(S3ImageEntity image) {
|
||||
public void setMainImage(@Nullable S3ImageEntity image) {
|
||||
this.mainImage = image;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class FullRecipeView {
|
||||
boolean includeRawText,
|
||||
int starCount,
|
||||
int viewerCount,
|
||||
ImageView mainImage
|
||||
@Nullable ImageView mainImage
|
||||
) {
|
||||
final FullRecipeView view = new FullRecipeView();
|
||||
view.setId(recipe.getId());
|
||||
@ -53,7 +53,7 @@ public class FullRecipeView {
|
||||
private UserInfoView owner;
|
||||
private int starCount;
|
||||
private int viewerCount;
|
||||
private ImageView mainImage;
|
||||
private @Nullable ImageView mainImage;
|
||||
private boolean isPublic;
|
||||
|
||||
public long getId() {
|
||||
@ -161,11 +161,11 @@ public class FullRecipeView {
|
||||
this.viewerCount = viewerCount;
|
||||
}
|
||||
|
||||
public ImageView getMainImage() {
|
||||
public @Nullable ImageView getMainImage() {
|
||||
return this.mainImage;
|
||||
}
|
||||
|
||||
public void setMainImage(ImageView mainImage) {
|
||||
public void setMainImage(@Nullable ImageView mainImage) {
|
||||
this.mainImage = mainImage;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user