Java Code Examples for org.powermock.api.easymock.PowerMock#verifyAll()

The following examples show how to use org.powermock.api.easymock.PowerMock#verifyAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableCellWalkerTest.java    From fastods with GNU General Public License v3.0 6 votes vote down vote up
@Test
public final void testDate() throws IOException {
    final Calendar c = Calendar.getInstance();
    c.setTimeInMillis(TIME_IN_MILLIS);
    final Date date = c.getTime();

    PowerMock.resetAll();
    this.to(0, 10);
    this.cell.setDateValue(date);

    PowerMock.replayAll();
    this.cellWalker = new TableCellWalker(this.table);
    this.cellWalker.to(10);
    this.cellWalker.setDateValue(date);

    PowerMock.verifyAll();
}
 
Example 2
Source File: TableAppenderTest.java    From fastods with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void appendTwoElementsPreambleTest() throws IOException {
    PowerMock.resetAll();
    EasyMock.expect(this.tb.getName()).andReturn("table1");
    EasyMock.expect(this.tb.getStyleName()).andReturn("table-style1");
    EasyMock.expect(this.tb.getCustomValueByAttribute()).andReturn(null);
    EasyMock.expect(this.tb.getColumns())
            .andReturn(FastFullList.newList(this.newTC("x"), this.newTC("x")));
    EasyMock.expect(this.tb.getShapes()).andReturn(Collections.<Shape>emptyList());

    PowerMock.replayAll();
    this.assertPreambleXMLEquals(
            "<table:table table:name=\"table1\" table:style-name=\"table-style1\" " +
                    "table:print=\"false\">" + "<office:forms form:automatic-focus=\"false\" " +
                    "form:apply-design-mode=\"false\"/>" +
                    "<table:table-column table:style-name=\"x\" " +
                    "table:number-columns-repeated=\"2\" " +
                    "table:default-cell-style-name=\"Default\"/>" + "<table:table-column " +
                    "table:style-name=\"co1\"" + " table:number-columns-repeated=\"1022\" " +
                    "table:default-cell-style-name=\"Default\"/>");

    PowerMock.verifyAll();
}
 
Example 3
Source File: OdsDocumentTest.java    From fastods with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testSetActiveTableSuccess() {
    final Table t = PowerMock.createMock(Table.class);

    PowerMock.resetAll();
    TestHelper.initMockDocument(this.odsElements);
    EasyMock.expect(this.odsElements.getTableCount()).andReturn(2);
    EasyMock.expect(this.odsElements.getTable(1)).andReturn(t);
    this.odsElements.setActiveTable(t);

    PowerMock.replayAll();
    final E document = this.getDocument();
    final boolean active1 = document.setActiveTable(1);

    PowerMock.verifyAll();
    Assert.assertTrue(active1);
}
 
Example 4
Source File: TableCellTest.java    From fastods with GNU General Public License v3.0 6 votes vote down vote up
@Test
public final void testTextWithStyle() throws IOException {
    PowerMock.resetAll();
    EasyMock.expect(TableColdCell.create(EasyMock.eq(this.xmlUtil))).andReturn(this.tcc);
    EasyMock.expect(this.stc.addContentFontFaceContainerStyle(TextStyle.DEFAULT_TEXT_STYLE))
            .andReturn(true);

    PowerMock.replayAll();
    this.cell.setText(Text.styledContent("text", TextStyle.DEFAULT_TEXT_STYLE));

    PowerMock.verifyAll();
    this.assertCellXMLEquals(
            "<table:table-cell office:value-type=\"string\" office:string-value=\"\">" +
                    "<text:p><text:span " +
                    "text:style-name=\"Default\">text</text:span></text:p>" +
                    "</table:table-cell>");
}
 
Example 5
Source File: TableCellWalkerTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testCellMergePass() throws IOException {
    PowerMock.resetAll();
    this.initWalker(0);

    PowerMock.replayAll();
    this.cellWalker = new TableCellWalker(this.table);
    this.cellWalker.setCellMerge(1, 1);

    PowerMock.verifyAll();
}
 
Example 6
Source File: TableCellWalkerTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testFormula() throws IOException {
    PowerMock.resetAll();
    this.to(0, 10);
    this.cell.setFormula("1000");

    PowerMock.replayAll();
    this.cellWalker = new TableCellWalker(this.table);
    this.cellWalker.to(10);
    this.cellWalker.setFormula("1000");

    PowerMock.verifyAll();
}
 
Example 7
Source File: TextValueTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testSet() {
    PowerMock.resetAll();
    final TableCell cell = PowerMock.createMock(TableCell.class);
    final Capture<Text> capturedValue = Capture.newInstance();
    cell.setText(EasyMock.capture(capturedValue));

    PowerMock.replayAll();
    final Text text = Text.content("text");
    final CellValue cv = new TextValue(text);
    cv.setToCell(cell);
    Assert.assertEquals(text, capturedValue.getValue());

    PowerMock.verifyAll();
}
 
Example 8
Source File: OdsFileWriterAdapterTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testFlushAdapteeWithEmptyQueue() throws Exception {
    PowerMock.resetAll();
    this.logger.fine("Retrieve first flusher: null");

    PowerMock.replayAll();
    this.wa.flushAdaptee();

    PowerMock.verifyAll();
}
 
Example 9
Source File: DynamoDBManagerTest.java    From aws-dynamodb-mars-json-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testCreateTableTableDoesNotExist() {
    final Collection<AttributeDefinition> ads = Arrays.asList(new AttributeDefinition("Hash", ScalarAttributeType.S));
    final Collection<KeySchemaElement> kses = Arrays.asList(new KeySchemaElement("Hash", KeyType.HASH));
    final TableDescription description = new TableDescription().withAttributeDefinitions(ads).withKeySchema(kses)
        .withTableName(tableName);
    final CreateTableResult cTR = new CreateTableResult().withTableDescription(description);
    EasyMock.expect(dynamoDB.describeTable(tableName)).andThrow(new ResourceNotFoundException(null));
    final CreateTableRequest request = new CreateTableRequest().withAttributeDefinitions(ads).withKeySchema(kses)
        .withTableName(tableName);
    EasyMock.expect(dynamoDB.createTable(request)).andReturn(cTR);
    PowerMock.replayAll();
    assertEquals(description, DynamoDBManager.createTable(dynamoDB, request));
    PowerMock.verifyAll();
}
 
Example 10
Source File: FastOdsTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testOpenInexistentFile() {
    final File f = PowerMock.createMock(File.class);

    PowerMock.resetAll();
    if (FastOds.desktop != null) {
        EasyMock.expect(f.exists()).andReturn(false);
    }

    PowerMock.replayAll();
    Assert.assertFalse(FastOds.openFile(f));

    PowerMock.verifyAll();
}
 
Example 11
Source File: OdsDocumentTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testSetActiveTableFailNeg() {
    PowerMock.resetAll();
    TestHelper.initMockDocument(this.odsElements);

    PowerMock.replayAll();
    final E document = this.getDocument();
    final boolean activeMin1 = document.setActiveTable(-1);

    PowerMock.verifyAll();
    Assert.assertFalse(activeMin1);
}
 
Example 12
Source File: OdsDocumentTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testAddExtraFile() {
    PowerMock.resetAll();
    TestHelper.initMockDocument(this.odsElements);
    final byte[] bytes = {'c', 'o', 'n', 't', 'e', 'n', 't'};
    this.odsElements.addExtraFile("path", "mt", bytes);

    PowerMock.replayAll();
    final E document = this.getDocument();
    document.addExtraFile("path", "mt", bytes);

    PowerMock.verifyAll();
}
 
Example 13
Source File: TableCellWalkerTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAddData() throws IOException {
    final DataWrapper dw = PowerMock.createMock(DataWrapper.class);

    PowerMock.resetAll();
    this.initWalker(0);
    EasyMock.expect(dw.addToTable(EasyMock.isA(TableCellWalker.class))).andReturn(true);

    PowerMock.replayAll();
    this.cellWalker = new TableCellWalker(this.table);
    this.cellWalker.addData(dw);

    PowerMock.verifyAll();
}
 
Example 14
Source File: RowCellWalkerImplTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testCalendar() {
    final Calendar c = Calendar.getInstance();
    c.setTimeInMillis(TIME_IN_MILLIS);

    PowerMock.resetAll();
    expect(this.row.getOrCreateCell(10)).andReturn(this.cell);
    this.cell.setDateValue(c);

    PowerMock.replayAll();
    this.cellWalker.to(10);
    this.cellWalker.setDateValue(c);

    PowerMock.verifyAll();
}
 
Example 15
Source File: TableCellWalkerTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testToRowFail() throws IOException {
    PowerMock.resetAll();
    this.initWalker(0);
    EasyMock.expect(this.table.getRow(10)).andReturn(this.row);
    EasyMock.expect(this.row.getOrCreateCell(0)).andReturn(this.cell);

    PowerMock.replayAll();
    this.cellWalker = new TableCellWalker(this.table);
    this.thrown.expect(IndexOutOfBoundsException.class);
    this.cellWalker.toRow(-10);

    PowerMock.verifyAll();
}
 
Example 16
Source File: TableCellTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testMarkRowsSpanned1() {
    PowerMock.resetAll();
    PowerMock.replayAll();
    this.cell.markColumnsSpanned(1);

    PowerMock.verifyAll();
}
 
Example 17
Source File: TableTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testStyle() {
    final TableStyle ts = TableStyle.builder("b").build();

    PowerMock.resetAll();
    EasyMock.expect(this.stc.addContentStyle(ts)).andReturn(true);
    EasyMock.expect(this.stc.addPageStyle(ts.getPageStyle())).andReturn(true);

    PowerMock.replayAll();
    this.table.setStyle(ts);
    Assert.assertEquals("my_table", this.table.getName());
    Assert.assertEquals("b", this.table.getStyleName());

    PowerMock.verifyAll();
}
 
Example 18
Source File: RowCellWalkerImplTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testSetTimeValue() {
    PowerMock.resetAll();
    EasyMock.expect(this.row.getOrCreateCell(0)).andReturn(this.cell);
    this.cell.setTimeValue(1, 2, 3, 4, 5, 6);

    PowerMock.replayAll();
    this.cellWalker.setTimeValue(1, 2, 3, 4, 5, 6);

    PowerMock.verifyAll();
}
 
Example 19
Source File: DateValueTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testFromDate() throws FastOdsException {
    PowerMock.resetAll();
    final TableCell cell = PowerMock.createMock(TableCell.class);
    cell.setDateValue(new Date(10));

    PowerMock.replayAll();
    final Date date = new Date(10);
    final CellValue dv = DateValue.from(date);
    date.setTime(0);
    dv.setToCell(cell);

    PowerMock.verifyAll();
}
 
Example 20
Source File: TableBuilderTest.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
@Test
public final void testRowsSpanned() throws IOException {
    PowerMock.resetAll();

    PowerMock.replayAll();
    this.builder.setRowsSpanned(this.table, this.appender, 10, 11, 12);

    PowerMock.verifyAll();
}