| 1 |
/* |
| 2 |
* Created on 15/set/2011 |
| 3 |
* Copyright 2011 by Andrea Vacondio ([email protected]). |
| 4 |
* |
| 5 |
* This file is part of the Sejda source code |
| 6 |
* |
| 7 |
* This program is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU Affero General Public License as |
| 9 |
* published by the Free Software Foundation, either version 3 of the |
| 10 |
* License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU Affero General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU Affero General Public License |
| 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
package org.sejda.impl.sambox; |
| 21 |
|
| 22 |
import static org.hamcrest.CoreMatchers.containsString; |
| 23 |
import static org.hamcrest.MatcherAssert.assertThat; |
| 24 |
import static org.junit.Assert.fail; |
| 25 |
|
| 26 |
import org.sejda.core.service.AlternateMixTaskTest; |
| 27 |
import org.sejda.impl.sambox.component.PdfTextExtractorByArea; |
| 28 |
import org.sejda.model.exception.TaskIOException; |
| 29 |
import org.sejda.model.parameter.AlternateMixMultipleInputParameters; |
| 30 |
import org.sejda.model.task.Task; |
| 31 |
import org.sejda.sambox.pdmodel.PDPage; |
| 32 |
|
| 33 |
/** |
| 34 |
* @author Andrea Vacondio |
| 35 |
* |
| 36 |
*/ |
| 37 |
public class AlternateMixSamboxTaskTest extends AlternateMixTaskTest { |
| 38 |
|
| 39 |
@Override |
| 40 |
public Task<AlternateMixMultipleInputParameters> getTask() { |
| 41 |
return new AlternateMixTask(); |
| 42 |
} |
| 43 |
|
| 44 |
@Override |
| 45 |
protected void assertHeaderContains(PDPage page, String expectedText) { |
| 46 |
try { |
| 47 |
assertThat(new PdfTextExtractorByArea().extractHeaderText(page).trim(), containsString(expectedText)); |
| 48 |
} catch (TaskIOException e) { |
| 49 |
fail(e.getMessage()); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
} |