1414
1515import com .ibm .cloud .sdk .core .http .HttpHeaders ;
1616import com .ibm .cloud .sdk .core .http .HttpMediaType ;
17- import com .ibm .cloud .sdk .core .security .basicauth . BasicAuthConfig ;
17+ import com .ibm .cloud .sdk .core .security .NoAuthAuthenticator ;
1818import com .ibm .cloud .sdk .core .util .RequestUtils ;
1919import com .ibm .watson .common .WatsonServiceUnitTest ;
2020import com .ibm .watson .tone_analyzer .v3 .model .ToneAnalysis ;
@@ -58,11 +58,7 @@ public class ToneAnalyzerTest extends WatsonServiceUnitTest {
5858 @ Before
5959 public void setUp () throws Exception {
6060 super .setUp ();
61- BasicAuthConfig authConfig = new BasicAuthConfig .Builder ()
62- .username ("" )
63- .password ("" )
64- .build ();
65- service = new ToneAnalyzer (VERSION_DATE_VALUE , authConfig );
61+ service = new ToneAnalyzer (VERSION_DATE_VALUE , new NoAuthAuthenticator ());
6662 service .setEndPoint (getMockWebServerUrl ());
6763
6864 }
@@ -73,8 +69,7 @@ public void setUp() throws Exception {
7369 @ Test
7470 public void testReadme () throws InterruptedException , IOException {
7571
76- ToneAnalyzer service = new ToneAnalyzer (VERSION_DATE );
77- service .setUsernameAndPassword ("<username>" , "<password>" );
72+ ToneAnalyzer service = new ToneAnalyzer (VERSION_DATE , new NoAuthAuthenticator ());
7873
7974 service .setEndPoint (getMockWebServerUrl ()); // exclude
8075 ToneAnalysis mockResponse = loadFixture (FIXTURE , ToneAnalysis .class ); // exclude
@@ -132,7 +127,6 @@ public void testtones() throws InterruptedException, IOException {
132127
133128 String path = StringUtils .join (TONE_PATH , "?" , VERSION_DATE , "=" , VERSION_DATE_VALUE );
134129 assertEquals (path , request .getPath ());
135- assertNotNull (request .getHeader (HttpHeaders .AUTHORIZATION ));
136130 assertEquals (serviceResponse , mockResponse );
137131 assertEquals (HttpMediaType .APPLICATION_JSON , request .getHeader (HttpHeaders .ACCEPT ));
138132
@@ -201,7 +195,6 @@ public void testGetChatTones() throws IOException, InterruptedException {
201195
202196 String path = StringUtils .join (CHAT_TONE_PATH , "?" , VERSION_DATE , "=" , VERSION_DATE_VALUE );
203197 assertEquals (path , request .getPath ());
204- assertNotNull (request .getHeader (HttpHeaders .AUTHORIZATION ));
205198 assertEquals (serviceResponse , mockResponse );
206199 assertEquals (HttpMediaType .APPLICATION_JSON , request .getHeader (HttpHeaders .ACCEPT ));
207200 }
0 commit comments