Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
fix(page): Creating page is requiring a page's type
Browse files Browse the repository at this point in the history
  • Loading branch information
brasseld committed Dec 1, 2016
1 parent 7703490 commit a7d6b95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Expand Up @@ -19,15 +19,17 @@
import javax.validation.constraints.Size;

/**
* @author Titouan COMPIEGNE
* @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
* @author GraviteeSource Team
*/
public class NewPageEntity {

@NotNull
@Size(min = 1)
private String name;

private String type;

@NotNull
private PageType type;

private String content;

Expand All @@ -46,12 +48,12 @@ public String getName() {
public void setName(String name) {
this.name = name;
}
public String getType() {

public PageType getType() {
return type;
}

public void setType(String type) {
public void setType(PageType type) {
this.type = type;
}

Expand Down
Expand Up @@ -334,9 +334,9 @@ private static Page convert(NewPageEntity newPageEntity) {
Page page = new Page();

page.setName(newPageEntity.getName());
final String type = newPageEntity.getType();
final PageType type = newPageEntity.getType();
if (type != null) {
page.setType(io.gravitee.repository.management.model.PageType.valueOf(type));
page.setType(io.gravitee.repository.management.model.PageType.valueOf(type.name()));
}
page.setContent(newPageEntity.getContent());
page.setLastContributor(newPageEntity.getLastContributor());
Expand Down
Expand Up @@ -164,7 +164,7 @@ public void shouldCreatePage() throws TechnicalException {
when(newPage.getOrder()).thenReturn(1);
when(newPage.getContent()).thenReturn(content);
when(newPage.getLastContributor()).thenReturn(contrib);
when(newPage.getType()).thenReturn(type);
when(newPage.getType()).thenReturn(io.gravitee.management.model.PageType.SWAGGER);

final PageEntity createdPage = pageService.create(API_ID, newPage);

Expand All @@ -176,7 +176,7 @@ public boolean matches(Object argument) {
name.equals(pageToCreate.getName()) &&
contrib.equals(pageToCreate.getLastContributor()) &&
content.equals(pageToCreate.getContent()) &&
type.equals(pageToCreate.getType().name()) &&
io.gravitee.management.model.PageType.SWAGGER.name().equals(pageToCreate.getType().name()) &&
pageToCreate.getCreatedAt() != null &&
pageToCreate.getUpdatedAt() != null &&
pageToCreate.getCreatedAt().equals(pageToCreate.getUpdatedAt());
Expand Down

0 comments on commit a7d6b95

Please sign in to comment.