DrishtiSMSService { public void canSendSMSes(boolean value) { this.canSendSMSes = value; } @Autowired  DrishtiSMSService(SmsService smsService, Auditor auditor, @Value("#{drishti['sms.can.be.sent']}") boolean defaultValueForWhetherSMSCanBeSent); void sendSMS(String recipient, String message); void canSendSMSes(boolean value);  }
@Test public void shouldNotSendAnSMSIfTheFlagIsTurnedOff() { DrishtiSMSService drishtiSMSService = new DrishtiSMSService(smsService, auditor, true); drishtiSMSService.canSendSMSes(false); assertMessageWillNotBeSent(drishtiSMSService); }
@Test public void shouldNotSendAnSMSIfTheFlagIsTurnedOn() { DrishtiSMSService drishtiSMSService = new DrishtiSMSService(smsService, auditor, true); drishtiSMSService.canSendSMSes(true); assertMessageWillBeSent(drishtiSMSService); }