Пример #1
0
  @Test
  public void testZipFileIter_HasNextAborted() throws Exception {
    Aborter aborter = PowerMock.createMock(Aborter.class);

    expect(aborter.isAborted()).andReturn(true);

    PowerMock.replayAll();
    assertFalse(new ZipFileIter(null, aborter, null).hasNext());
    PowerMock.verifyAll();
  }
Пример #2
0
  @Test
  public void testZipFileIter_HasNextNone() throws Exception {
    GpxZipInputStream zipInputStream = PowerMock.createMock(GpxZipInputStream.class);
    Aborter aborter = PowerMock.createMock(Aborter.class);

    expect(aborter.isAborted()).andReturn(false);
    expect(zipInputStream.getNextEntry()).andReturn(null);

    PowerMock.replayAll();
    assertFalse(new ZipFileIter(zipInputStream, aborter, null).hasNext());
    PowerMock.verifyAll();
  }
Пример #3
0
  @Test
  public void testZipFileIter_HasNextTrue() throws Exception {
    GpxZipInputStream zipInputStream = PowerMock.createMock(GpxZipInputStream.class);
    ZipEntry zipEntry = PowerMock.createMock(ZipEntry.class);
    Aborter aborter = PowerMock.createMock(Aborter.class);
    ZipInputFileTester zipInputFileTester = PowerMock.createMock(ZipInputFileTester.class);

    expect(aborter.isAborted()).andReturn(false);
    expect(zipInputStream.getNextEntry()).andReturn(zipEntry);
    expect(zipInputFileTester.isValid(zipEntry)).andReturn(true);

    PowerMock.replayAll();
    assertTrue(new ZipFileIter(zipInputStream, aborter, zipInputFileTester, null).hasNext());
    PowerMock.verifyAll();
  }