Skip to content
Permalink
Browse files

feat(view): add picture's view

  • Loading branch information...
tcompiegne committed Feb 3, 2019
1 parent 6ada3d0 commit 729176b2e872295815200063e5f2031758263f90
@@ -32,7 +32,7 @@
<name>Gravitee.io APIM - Repository - Test</name>

<properties>
<gravitee-repository.version>1.22.0</gravitee-repository.version>
<gravitee-repository.version>1.23.0-SNAPSHOT</gravitee-repository.version>
<commons-io.version>1.3.2</commons-io.version>
<jackson-mapper-asl.version>1.9.13</jackson-mapper-asl.version>
<javax.inject.version>1</javax.inject.version>
@@ -24,6 +24,10 @@

import static org.junit.Assert.*;

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

@Override
@@ -50,6 +54,7 @@ public void shouldCreate() throws Exception {
view.setHidden(true);
view.setOrder(1);
view.setDefaultView(true);
view.setPicture("New picture");

int nbViewsBeforeCreation = viewRepository.findAll().size();
viewRepository.create(view);
@@ -68,6 +73,7 @@ public void shouldCreate() throws Exception {
Assert.assertEquals("Invalid view hidden.", view.isHidden(), viewSaved.isHidden());
Assert.assertEquals("Invalid view order.", view.getOrder(), viewSaved.getOrder());
Assert.assertEquals("Invalid view defaultView.", view.isDefaultView(), viewSaved.isDefaultView());
Assert.assertEquals("Invalid view picture.", "New picture", viewSaved.getPicture());
}

@Test
@@ -85,6 +91,7 @@ public void shouldUpdate() throws Exception {
view.setCreatedAt(new Date(1486771200000L));
view.setUpdatedAt(new Date(1486771200000L));
view.setHighlightApi("new Highlighted API");
view.setPicture("New picture");

int nbViewsBeforeUpdate = viewRepository.findAll().size();
viewRepository.update(view);
@@ -104,6 +111,7 @@ public void shouldUpdate() throws Exception {
Assert.assertEquals("Invalid view order.", view.getOrder(), viewUpdated.getOrder());
Assert.assertEquals("Invalid view defaultView.", view.isDefaultView(), viewUpdated.isDefaultView());
Assert.assertEquals("Invalid view highlight API.", view.getHighlightApi(), viewUpdated.getHighlightApi());
Assert.assertEquals("Invalid view picture.", "New picture", viewUpdated.getPicture());
}

@Test
@@ -48,6 +48,7 @@ void prepare(ViewRepository viewRepository) throws Exception {
when(newView.isHidden()).thenReturn(true);
when(newView.getOrder()).thenReturn(1);
when(newView.isDefaultView()).thenReturn(true);
when(newView.getPicture()).thenReturn("New picture");


final View viewProducts = new View();
@@ -68,6 +69,7 @@ void prepare(ViewRepository viewRepository) throws Exception {
when(viewProductsUpdated.getOrder()).thenReturn(10);
when(viewProductsUpdated.isDefaultView()).thenReturn(true);
when(viewProductsUpdated.getHighlightApi()).thenReturn("new Highlighted API");
when(viewProductsUpdated.getPicture()).thenReturn("New picture");

final Set<View> views = newSet(newView, viewProducts, mock(View.class));
final Set<View> viewsAfterDelete = newSet(newView, viewProducts);

0 comments on commit 729176b

Please sign in to comment.
You can’t perform that action at this time.