Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.drools.guvnor.server.builder;
 
 import static junit.framework.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.List;
 
public class PageResponseBuilderTest {
                                                                               List<AbstractPageRowrowList,
                                                                               boolean hasMoreRows) {
        return new PageResponseBuilder<AbstractPageRow>()
                .withStartRowIndexstartRowIndex )
                .withPageRowListrowList )
                .withLastPage( !hasMoreRows );
    }
    @Test(expected = IllegalStateException.class)
        createPageResponseBuilderWith( 0,
                                       null,
                                       true ).buildWithTotalRowCount. );
    }
    @Test
        @SuppressWarnings("rawtypes")
        List rowList = mockList.class );
        whenrowList.size() ).thenReturn( 11 );
        @SuppressWarnings("unchecked")
        PageResponse<AbstractPageRowpageResponse = createPageResponseBuilderWith( 10,
                                                                                    rowList,
                                                                                    false ).buildWithTotalRowCount( -1 );
        assertEqualspageResponse.getTotalRowSize(),
                      21 );
        assertEqualspageResponse.isTotalRowSizeExact(),
                      true );
    }
    @Test
        @SuppressWarnings("rawtypes")
        List rowList = mockList.class );
        whenrowList.size() ).thenReturn( 11 );
        @SuppressWarnings("unchecked")
        PageResponse<AbstractPageRowpageResponse = createPageResponseBuilderWith( 10,
                                                                                    rowList,
                                                                                    true ).buildWithTotalRowCount( -1 );
        assertEqualspageResponse.getTotalRowSize(),
                      -1 );
        assertEqualspageResponse.isTotalRowSizeExact(),
                      false );
    }
    @Test
        @SuppressWarnings("rawtypes")
        List rowList = mockList.class );
        whenrowList.size() ).thenReturn( 11 );
        @SuppressWarnings("unchecked")
        PageResponse<AbstractPageRowpageResponse = createPageResponseBuilderWith( 10,
                                                                                    rowList,
                                                                                    true ).buildWithTotalRowCount( 100 );
        assertEqualspageResponse.getTotalRowSize(),
                      100 );
        assertEqualspageResponse.isTotalRowSizeExact(),
                      true );
    }
New to GrepCode? Check out our FAQ X