Skip to content

Commit

Permalink
Whitespace license and unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
timyates committed Jan 3, 2024
1 parent c4c764e commit 1395235
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package example.micronaut;

import io.micronaut.http.HttpHeaders;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Produces;
import io.micronaut.scheduling.TaskExecutors;
import io.micronaut.scheduling.annotation.ExecuteOn;

Expand All @@ -19,6 +33,7 @@

@Controller("/pdf") // <1>
class PDFController {

@ExecuteOn(TaskExecutors.BLOCKING) // <2>
@Get("/download") // <3>
HttpResponse<byte[]> download() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package example.micronaut;

import com.lowagie.text.pdf.PdfReader;
Expand All @@ -14,10 +29,12 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;

@MicronautTest // <1>
class PDFControllerTest {

@Test
void testDownload(@Client("/") HttpClient httpClient) throws IOException { // <2>
BlockingHttpClient client = httpClient.toBlocking();
Expand All @@ -32,7 +49,7 @@ void testDownload(@Client("/") HttpClient httpClient) throws IOException { // <2

private static String textAtPage(PdfReader pdfReader, int pageNumber) throws IOException {
PdfTextExtractor pdfTextExtractor = new PdfTextExtractor(pdfReader);
return pdfTextExtractor.getTextFromPage(1);
return pdfTextExtractor.getTextFromPage(pageNumber);
}

private static String textAtPage(byte[] pdfBytes, int pageNumber) throws IOException {
Expand Down

0 comments on commit 1395235

Please sign in to comment.