File tree Expand file tree Collapse file tree 6 files changed +369
-33
lines changed
integration-test/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/reporting
main/java/com/jaspersoft/jasperserver/jaxrs/client
test/java/com/jaspersoft/jasperserver/jaxrs/client Expand file tree Collapse file tree 6 files changed +369
-33
lines changed Original file line number Diff line number Diff line change 33import com .jaspersoft .jasperserver .jaxrs .client .core .JasperserverRestClient ;
44import com .jaspersoft .jasperserver .jaxrs .client .core .RestClientConfiguration ;
55import com .jaspersoft .jasperserver .jaxrs .client .core .operationresult .OperationResult ;
6+ <<<<<<< HEAD
67import java .io .FileOutputStream ;
78import java .io .IOException ;
89import java .io .InputStream ;
910import java .io .OutputStream ;
11+ =======
12+ import java .io .InputStream ;
13+ >>>>>>> develop
1014import junit .framework .Assert ;
1115import org .testng .annotations .AfterMethod ;
1216import org .testng .annotations .BeforeMethod ;
1317import org .testng .annotations .Test ;
1418/**
15- * @author
16- * @author tetiana Iefimenko
19+ * @author Alex Krasnyanskiy
20+ * @author Tetiana Iefimenko
1721 */
1822public class ReportingServiceIT {
1923
@@ -45,28 +49,6 @@ public void should_return_proper_entity_if_pass_jrprint_report_output_format() {
4549 /** Then **/
4650 Assert .assertNotNull (entity );
4751
48- OutputStream output = null ;
49- try {
50- output = new FileOutputStream ("file.pdf" );
51- int i = 0 ;
52- while (i != -1 ) {
53- i = entity .read ();
54- output .write (i );
55- output .flush ();
56-
57- }
58- } catch (IOException e ) {
59- e .printStackTrace ();
60- } finally {
61-
62- try {
63- entity .close ();
64- output .close ();
65- } catch (IOException e ) {
66- e .printStackTrace ();
67- }
68- }
69-
7052 }
7153
7254 @ AfterMethod
Original file line number Diff line number Diff line change @@ -78,15 +78,15 @@ public OperationResult<InputControlsSettings> ofInputControlsGroup() {
7878 return request (InputControlsSettings .class ).get ();
7979 }
8080
81- private <T > JerseyRequest <T > request (Class <T > resultClass ) {
81+ private <T > JerseyRequest <T > request (Class <T > resultClass ) {
8282 return JerseyRequest .buildRequest (
8383 sessionStorage ,
8484 resultClass ,
8585 new String []{"/settings/" + groupKey },
8686 new DefaultErrorHandler ());
8787 }
8888
89- private <T > JerseyRequest <T > request (GenericType <T > genericType ) {
89+ private <T > JerseyRequest <T > request (GenericType <T > genericType ) {
9090 return JerseyRequest .buildRequest (
9191 sessionStorage ,
9292 genericType ,
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public AnonymousSession getAnonymousSession() {
4949 return new AnonymousSession (new SessionStorage (configuration , null ));
5050 }
5151
52- private void login (SessionStorage storage ) {
52+ protected void login (SessionStorage storage ) {
5353
5454 AuthenticationCredentials credentials = storage .getCredentials ();
5555 WebTarget rootTarget = storage .getRootTarget ();
Original file line number Diff line number Diff line change 1+ package com .jaspersoft .jasperserver .jaxrs .client .apiadapters .settings ;
2+
3+ import com .jaspersoft .jasperserver .jaxrs .client .core .JerseyRequest ;
4+ import com .jaspersoft .jasperserver .jaxrs .client .core .SessionStorage ;
5+ import org .powermock .core .classloader .annotations .PrepareForTest ;
6+ import org .powermock .modules .testng .PowerMockTestCase ;
7+ import org .testng .annotations .Test ;
8+
9+ import static org .mockito .Mockito .mock ;
10+ import static org .testng .Assert .assertNotNull ;
11+
12+ /**
13+ * @author Tetiana Iefimenko
14+ */
15+ @ PrepareForTest ({JerseyRequest .class })
16+ public class SettingsServiceTest extends PowerMockTestCase {
17+
18+ private SettingsService service = new SettingsService (mock (SessionStorage .class ));
19+
20+ @ Test
21+ public void should_return_proper_settings_adapter () throws Exception {
22+ //when
23+ SingleSettingsAdapter retrieved = service .settings ();
24+ //then
25+ assertNotNull (retrieved );
26+
27+ }
28+
29+ }
You can’t perform that action at this time.
0 commit comments