← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9886: (mobile) Fixed unit test

 

------------------------------------------------------------
revno: 9886
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-25 10:08:12 +0700
message:
  (mobile) Fixed unit test
modified:
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java'
--- dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java	2013-02-22 07:40:35 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java	2013-02-25 03:08:12 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.sms.outbound;
 
-import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
-import static org.mockito.Matchers.*;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.refEq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -11,23 +11,18 @@
 import java.util.HashSet;
 import java.util.Map;
 
-import org.hisp.dhis.sms.outbound.OutboundSms;
-import org.hisp.dhis.sms.outbound.OutboundSmsService;
-import org.hisp.dhis.sms.outbound.SmsMessageSender;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
-import org.junit.Ignore;
 import org.junit.Test;
 
 @SuppressWarnings( "serial" )
 public class SmsMessageSenderTest
 {
-    @Ignore //TODO Fix
     @Test
     public void testMessageSender()
     {
         final User user = getUser();
-        Map<User, Serializable> settings = getUserSettings( user );
+        //Map<User, Serializable> settings = getUserSettings( user );
 
         SmsMessageSender smsMessageSender = new SmsMessageSender();
 
@@ -35,14 +30,14 @@
         when( outboundSmsService.isEnabled() ).thenReturn( true );
 
         UserService userService = mock( UserService.class );
-        when( userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false ) ).thenReturn( settings );
+        //when( userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false ) ).thenReturn( settings );
 
         smsMessageSender.setOutboundSmsService( outboundSmsService );
         smsMessageSender.setUserService( userService );
         smsMessageSender.sendMessage( "Hello", "hello", user, false, getUserSet( user ), null );
 
         verify( outboundSmsService ).isEnabled();
-        verify( userService ).getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false );
+        //verify( userService ).getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false );
         verify( outboundSmsService ).sendMessage( refEq(getSms()), anyString() );
     }