示例#1
0
 @Test
 public void emptyPassword() {
   try {
     picasa.login("USERNAME", "");
     fail();
   } catch (AuthenticationException e) {
     assertEquals("Password can not be empty", e.getMessage());
   }
 }
示例#2
0
 @Test
 public void emptyUsername() {
   try {
     picasa.login("", "PASSWORD");
     fail();
   } catch (AuthenticationException e) {
     assertEquals("Username can not be empty", e.getMessage());
   }
 }
 private void upload(CalendarEventEntry entry) {
   try {
     long startTime = System.currentTimeMillis();
     CalendarEventEntry createdEvent = createCalendarEvent(username, password, url, entry);
     logger.debug(
         "succesfully created new calendar event (title='{}', date='{}', content='{}') in {}ms",
         new Object[] {
           createdEvent.getTitle().getPlainText(),
           createdEvent.getTimes().get(0).getStartTime().toString(),
           createdEvent.getPlainTextContent(),
           System.currentTimeMillis() - startTime
         });
   } catch (AuthenticationException ae) {
     logger.error("authentication failed: {}", ae.getMessage());
   } catch (Exception e) {
     logger.error("creating a new calendar entry throws an exception: {}", e.getMessage());
   }
 }