1313package com .ibm .watson .personality_insights .v3 ;
1414
1515import com .google .common .io .CharStreams ;
16- import com .ibm .cloud .sdk .core .service . security .IamOptions ;
16+ import com .ibm .cloud .sdk .core .security .IamAuthenticator ;
1717import com .ibm .watson .common .WatsonServiceTest ;
1818import com .ibm .watson .personality_insights .v3 .model .ConsumptionPreferences ;
1919import com .ibm .watson .personality_insights .v3 .model .Content ;
2929import java .io .FileInputStream ;
3030import java .io .InputStream ;
3131import java .io .InputStreamReader ;
32- import java .util .Arrays ;
32+ import java .util .Collections ;
3333import java .util .Date ;
3434import java .util .UUID ;
3535
@@ -56,12 +56,9 @@ public void setUp() throws Exception {
5656
5757 Assume .assumeFalse ("config.properties doesn't have valid credentials." , apiKey == null );
5858
59- service = new PersonalityInsights (VERSION_DATE_2016_10_19 );
59+ IamAuthenticator authenticator = new IamAuthenticator (apiKey );
60+ service = new PersonalityInsights (VERSION_DATE_2016_10_19 , authenticator );
6061 service .setEndPoint (getProperty ("personality_insights.url" ));
61- IamOptions iamOptions = new IamOptions .Builder ()
62- .apiKey (apiKey )
63- .build ();
64- service .setIamCredentials (iamOptions );
6562 service .setDefaultHeaders (getDefaultHeaders ());
6663 }
6764
@@ -190,7 +187,7 @@ public void getProfileWithASingleContentItem() throws Exception {
190187 .reply (false )
191188 .parentid (null )
192189 .build ();
193- Content content = new Content .Builder (Arrays . asList (cItem )).build ();
190+ Content content = new Content .Builder (Collections . singletonList (cItem )).build ();
194191 ProfileOptions options = new ProfileOptions .Builder ()
195192 .content (content )
196193 .consumptionPreferences (true )
@@ -205,7 +202,6 @@ public void getProfileWithASingleContentItem() throws Exception {
205202 Assert .assertNotNull (profile .getValues ().get (0 ).getCategory ());
206203 Assert .assertNotNull (profile .getValues ().get (0 ).getName ());
207204 Assert .assertNotNull (profile .getValues ().get (0 ).getTraitId ());
208- //Assert.assertNotNull(profile.getValues().get(0).getChildren());
209205 Assert .assertNotNull (profile .getValues ().get (0 ).getPercentile ());
210206 Assert .assertNotNull (profile .getValues ().get (0 ).getRawScore ());
211207
@@ -241,7 +237,7 @@ public void getProfileWithASingleSpanishContentItem() throws Exception {
241237 .language (ContentItem .Language .ES )
242238 .build ();
243239 Content content = new Content .Builder ()
244- .contentItems (Arrays . asList (cItem ))
240+ .contentItems (Collections . singletonList (cItem ))
245241 .build ();
246242 ProfileOptions options = new ProfileOptions .Builder ()
247243 .content (content )
0 commit comments