dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15110
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5328: Test ended up in the wrong package..
------------------------------------------------------------
revno: 5328
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-07 22:25:57 +0100
message:
Test ended up in the wrong package..
removed:
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms/
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms/SmsMessageSenderTest.java
added:
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/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
=== removed directory 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api'
=== removed directory 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms'
=== removed file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms/SmsMessageSenderTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms/SmsMessageSenderTest.java 2011-12-07 21:06:08 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/api/sms/SmsMessageSenderTest.java 1970-01-01 00:00:00 +0000
@@ -1,67 +0,0 @@
-package org.hisp.dhis.api.sms;
-
-import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.hisp.dhis.mobile.service.SmsMessageSender;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserService;
-import org.junit.Test;
-
-public class SmsMessageSenderTest
-{
-
- SmsMessageSender smsMessageSender;
-
- @Test
- public void testMessageSender()
- {
-
- smsMessageSender = new SmsMessageSender();
-
- OutboundSmsService outboundSmsService = mock( OutboundSmsService.class );
- when( outboundSmsService.isSmsServiceAvailable() ).thenReturn( true );
-
- UserService userService = mock( UserService.class );
- final User user = getUser();
- Map<User, Serializable> settings = getUserSettings( user );
- when( userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false ) ).thenReturn( settings );
-
- smsMessageSender.setOutboundSmsService( outboundSmsService );
- smsMessageSender.setUserService( userService );
- smsMessageSender.sendMessage( "Hello", "hello", user, getUserSet( user ));
-
- verify(outboundSmsService).isSmsServiceAvailable();
- verify( userService ).getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false );
- verify( outboundSmsService ).sendMessage( eq("From null, Hello: hello"), eq("222222") );
- }
-
- private HashSet<User> getUserSet( final User user )
- {
- return new HashSet<User>(){{add( user );}};
- }
-
- private Map<User, Serializable> getUserSettings( final User user )
- {
- Map<User, Serializable> settings = new HashMap<User, Serializable>(){{put(user, true);}};
- return settings;
- }
-
- private User getUser()
- {
- final User user = new User();
- user.setId( 1 );
- user.setPhoneNumber( "222222" );
- user.setFirstName( "firstName" );
- user.setSurname( "surname" );
- return user;
- }
-}
=== added directory 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service'
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/SmsMessageSenderTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/SmsMessageSenderTest.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/service/SmsMessageSenderTest.java 2011-12-07 21:25:57 +0000
@@ -0,0 +1,65 @@
+package org.hisp.dhis.mobile.service;
+
+import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.hisp.dhis.api.sms.OutboundSmsService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserService;
+import org.junit.Test;
+
+public class SmsMessageSenderTest
+{
+
+
+ @Test
+ public void testMessageSender()
+ {
+
+ SmsMessageSender smsMessageSender = new SmsMessageSender();
+
+ OutboundSmsService outboundSmsService = mock( OutboundSmsService.class );
+ when( outboundSmsService.isSmsServiceAvailable() ).thenReturn( true );
+
+ UserService userService = mock( UserService.class );
+ final User user = getUser();
+ Map<User, Serializable> settings = getUserSettings( user );
+ when( userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false ) ).thenReturn( settings );
+
+ smsMessageSender.setOutboundSmsService( outboundSmsService );
+ smsMessageSender.setUserService( userService );
+ smsMessageSender.sendMessage( "Hello", "hello", user, getUserSet( user ) );
+
+ verify( outboundSmsService ).isSmsServiceAvailable();
+ verify( userService ).getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false );
+ verify( outboundSmsService ).sendMessage( eq( "From null, Hello: hello" ), eq( "222222" ) );
+ }
+
+ private HashSet<User> getUserSet( final User user )
+ {
+ return new HashSet<User>() {{ add( user ); }};
+ }
+
+ private Map<User, Serializable> getUserSettings( final User user )
+ {
+ return new HashMap<User, Serializable>() {{ put( user, true ); }};
+ }
+
+ private User getUser()
+ {
+ final User user = new User();
+ user.setId( 1 );
+ user.setPhoneNumber( "222222" );
+ user.setFirstName( "firstName" );
+ user.setSurname( "surname" );
+ return user;
+ }
+}