method2testcases stringlengths 118 6.63k |
|---|
### Question:
OMIManagerImpl implements OMIManager, ApplicationContextAware { public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } void setApplicationC... |
### Question:
MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails... |
### Question:
MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName()... |
### Question:
MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType... |
### Question:
MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder... |
### Question:
LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(respo... |
### Question:
IMPManagerImpl implements ApplicationContextAware, IMPManager { public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLParser(); Incoming... |
### Question:
ReportStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMe... |
### Question:
StatusHandlerImpl implements StatusHandler { public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } void handleStatus(GatewayResponse r... |
### Question:
StatusHandlerImpl implements StatusHandler { public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } void handleStatus(GatewayResponse response); boolean registerStatusAction(MStatus status, StatusAction action); Map<MStatus, List<Status... |
### Question:
IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncom... |
### Question:
IntellIVRController extends AbstractController implements ResourceLoaderAware { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null;... |
### Question:
ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.tri... |
### Question:
ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responsePa... |
### Question:
ClickatellGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, ... |
### Question:
ClickatellGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); post... |
### Question:
ClickatellGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } ClickatellGatewayManagerImpl(); Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageSta... |
### Question:
IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); Incoming... |
### Question:
Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); static Instantiator<T> createInstantiator(
Class<T> klass, InstantiatorModule... modules); @SuppressWarnings({ "... |
### Question:
StringConstructorConverter implements Converter<T> { @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unr... |
### Question:
InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field ... |
### Question:
InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
... |
### Question:
InstantiatorImpl implements Instantiator<T> { @Override public Constructor<T> getConstructor() { return constructor; } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] defaultValue... |
### Question:
CollectionOfElementsConverter implements Converter<T> { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String p... |
### Question:
ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new Ill... |
### Question:
NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } T fromString(String representation); String toString(T value); }### Answer:
@Test public void fromNullString() throws Exception { C... |
### Question:
NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } T fromString(String representation); String toString(T value); }### Answer:
@Test public void nullToString() throws Exception { Converter<Boolean> converter = new... |
### Question:
InstantiatorErrors { @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s... |
### Question:
InstantiatorErrors { static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } }### Answer:
@Test public void incorrectDefaultValue() { check( "java.lang.NumberFormatException: For d... |
### Question:
InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } }### Answer:
@Test public void illegalConstructor1() { check( "class java.lang.String has ... |
### Question:
InstantiatorErrors { static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } }### Answer:
@Test public void enumHasAmbiguousNames() { check( "enum com.kaching.platform.converters.InstantiatorErrors... |
### Question:
InstantiatorErrors { static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } }### Answer:
@Test public void moreThanOneMatchingFunction() { check( "class com.kaching.platform.converters.InstantiatorErrorsTest$Amb... |
### Question:
InstantiatorErrors { static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } }### Answer:
@Test public void noConverterForType() { check( "no converter for java.util.List<java.lang.String>", InstantiatorErrors.noConverterForType( new Errors... |
### Question:
InstantiatorErrors { static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } }### Answer:
@Test public void addinTwiceTheSameMessageDoesNotDuplicateTheError() { check( "no such field a", noSuchField(noSuchField(new Errors(), "a"), "a")); ... |
### Question:
InstantiatorErrors { static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } }### ... |
### Question:
InstantiatorErrors { static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } }### Answer:
@Test public void unableToResolveLocalConstant() throws Exception { check( ... |
### Question:
AbstractImmutableType extends AbstractType { public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disas... |
### Question:
AbstractImmutableType extends AbstractType { public final Object deepCopy(Object value) { return value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
... |
### Question:
AbstractImmutableType extends AbstractType { public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, ... |
### Question:
AbstractImmutableType extends AbstractType { public final boolean isMutable() { return false; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
Serializ... |
### Question:
AbstractType { public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } final boolean equals(Object x, Object y); final int hashCode(Object value); }### Answer:
@Test public ... |
### Question:
AbstractType { public final int hashCode(Object value) throws HibernateException { return value.hashCode(); } final boolean equals(Object x, Object y); final int hashCode(Object value); }### Answer:
@Test public void hashing() { assertEquals(serializable.hashCode(), type.hashCode(serializable)); } |
### Question:
AbstractStringImmutableType extends AbstractImmutableType implements UserType { public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else... |
### Question:
TypeLiterals { @SuppressWarnings("unchecked") public static <T> TypeLiteral<T> get(Class<T> type, Type... parameters) { return (TypeLiteral<T>) TypeLiteral.get(new ParameterizedTypeImpl(type, parameters)); } private TypeLiterals(); @SuppressWarnings("unchecked") static TypeLiteral<T> get(Class<T> type, T... |
### Question:
ResultsMatcher extends TypeSafeDiagnosingMatcher<RecurrenceRule> { public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); } ResultsMatcher(DateTime start, Matcher<Integer> countMatcher); static Matcher<RecurrenceRule> results(Da... |
### Question:
WeekOfYearMatcher extends FeatureMatcher<DateTime, Integer> { public static Matcher<DateTime> inWeekOfYear(Matcher<Integer> weekOfYearMatcher) { return new WeekOfYearMatcher(weekOfYearMatcher); } WeekOfYearMatcher(Matcher<Integer> subMatcher); static Matcher<DateTime> inWeekOfYear(Matcher<Integer> weekOfY... |
### Question:
DayOfMonthMatcher extends FeatureMatcher<DateTime, Integer> { public static Matcher<DateTime> onDayOfMonth(Matcher<Integer> dayMatcher) { return new DayOfMonthMatcher(dayMatcher); } DayOfMonthMatcher(Matcher<Integer> subMatcher); static Matcher<DateTime> onDayOfMonth(Matcher<Integer> dayMatcher); static M... |
### Question:
MonthMatcher extends FeatureMatcher<DateTime, Integer> { public static Matcher<DateTime> inMonth(Matcher<Integer> monthMatcher) { return new MonthMatcher(monthMatcher); } MonthMatcher(Matcher<Integer> subMatcher); static Matcher<DateTime> inMonth(Matcher<Integer> monthMatcher); static Matcher<DateTime> in... |
### Question:
AfterMatcher extends TypeSafeDiagnosingMatcher<DateTime> { public static Matcher<DateTime> after(String dateTime) { return after(DateTime.parse(dateTime)); } AfterMatcher(DateTime referenceDate); static Matcher<DateTime> after(String dateTime); static Matcher<DateTime> after(DateTime dateTime); @Override ... |
### Question:
WeekDayMatcher extends FeatureMatcher<DateTime, Weekday> { public static Matcher<DateTime> onWeekDay(Matcher<Weekday> weekdayMatcher) { return new WeekDayMatcher(weekdayMatcher); } WeekDayMatcher(Matcher<Weekday> subMatcher); static Matcher<DateTime> onWeekDay(Matcher<Weekday> weekdayMatcher); static Matc... |
### Question:
BeforeMatcher extends TypeSafeDiagnosingMatcher<DateTime> { public static Matcher<DateTime> before(String dateTime) { return before(DateTime.parse(dateTime)); } BeforeMatcher(DateTime referenceDate); static Matcher<DateTime> before(String dateTime); static Matcher<DateTime> before(DateTime dateTime); @Ove... |
### Question:
DayOfYearMatcher extends FeatureMatcher<DateTime, Integer> { public static Matcher<DateTime> onDayOfYear(Matcher<Integer> dayMatcher) { return new DayOfYearMatcher(dayMatcher); } DayOfYearMatcher(Matcher<Integer> subMatcher); static Matcher<DateTime> onDayOfYear(Matcher<Integer> dayMatcher); static Matche... |
### Question:
YearMatcher extends FeatureMatcher<DateTime, Integer> { public static Matcher<DateTime> inYear(Matcher<Integer> yearMatcher) { return new YearMatcher(yearMatcher); } YearMatcher(Matcher<Integer> subMatcher); static Matcher<DateTime> inYear(Matcher<Integer> yearMatcher); static Matcher<DateTime> inYear(Int... |
### Question:
VanillaSharedReplicatedHashMap extends AbstractVanillaSharedHashMap<K, V> implements SharedHashMap<K, V>, ReplicaExternalizable<K, V>, EntryResolver<K, V>,
Closeable { @NotNull @Override public Set<Entry<K, V>> entrySet() { return new EntrySet(); } VanillaSharedReplicatedHashMap(@NotNull SharedHas... |
### Question:
HugeHashMap extends AbstractMap<K, V> implements HugeMap<K, V> { @Override public V put(K key, V value) { long hash = hasher.hash(key); int segment = hasher.getSegment(hash); int segmentHash = hasher.segmentHash(hash); segments[segment].put(segmentHash, key, value, true, true); return null; } HugeHashMap(... |
### Question:
HugeHashMap extends AbstractMap<K, V> implements HugeMap<K, V> { @Override public V remove(Object key) { long hash = hasher.hash(key); int segment = hasher.getSegment(hash); int segmentHash = hasher.segmentHash(hash); segments[segment].remove(segmentHash, (K) key); return null; } HugeHashMap(); HugeHashM... |
### Question:
VanillaSharedReplicatedHashMap extends AbstractVanillaSharedHashMap<K, V> implements SharedHashMap<K, V>, ReplicaExternalizable<K, V>, EntryResolver<K, V>,
Closeable { @Override public V putIfAbsent(@net.openhft.lang.model.constraints.NotNull K key, V value) { return put0(key, value, false, localI... |
### Question:
VanillaSharedReplicatedHashMap extends AbstractVanillaSharedHashMap<K, V> implements SharedHashMap<K, V>, ReplicaExternalizable<K, V>, EntryResolver<K, V>,
Closeable { @Override public V remove(final Object key) { return removeIfValueIs(key, null, localIdentifier, timeProvider.currentTimeMillis())... |
### Question:
VanillaSharedReplicatedHashMap extends AbstractVanillaSharedHashMap<K, V> implements SharedHashMap<K, V>, ReplicaExternalizable<K, V>, EntryResolver<K, V>,
Closeable { @Override public V put(K key, V value) { return put0(key, value, true, localIdentifier, timeProvider.currentTimeMillis()); } Vanil... |
### Question:
DataExtractionSupport { public String process(Object extractionObj, Response response, Map retrievedParametersFlowMode) { String outputStr = ""; this.retrievedParametersFlowMode = retrievedParametersFlowMode; logUtils.trace("extractionObj = '{}'", extractionObj.toString()); if (extractionObj.getClass().eq... |
### Question:
MultipartUtils { public static List<MultiPartSpecification> convertToMultipart(List<Map<String, String>> parts) { return parts.stream() .map(part -> { final MultiPartSpecification specification; final String name = part.get(TestCaseUtils.JSON_FIELD_MULTIPART_NAME); Preconditions.checkNotNull(name, "'%s' f... |
### Question:
PlaceholderHandler { public String processHeaderPlaceholder(String inputString) { String outputString = inputString; if (response != null) { outputString = processGenericPlaceholders(inputString, REGEXP_HEADER_PLACEHOLDER, this::getHeaderVar); } return outputString; } PlaceholderHandler(); Map<String, Hea... |
### Question:
PlaceholderHandler { private String processCookiePlaceholder(String input) { String outputObj = input; if (response != null) { outputObj = processGenericPlaceholders(input, REGEXP_COOKIE_PLACEHOLDER, this::getCookieVar); } return outputObj; } PlaceholderHandler(); Map<String, HeatPlaceholderModuleProvider... |
### Question:
OperationHandler { public boolean execute() { boolean isExecutionOk = true; if (!fieldsToCheck.containsKey(JSON_ELEM_ACTUAL_VALUE) || !fieldsToCheck.containsKey(JSON_ELEM_EXPECTED_VALUE)) { throw new HeatException("json input format not supported! '" + fieldsToCheck.toString() + "'"); } if (isComparingBlo... |
### Question:
MotechUserRepository { public User newUser(WebStaff webStaff) { User user = new User(); user.setSystemId(identifierGenerator.generateStaffId()); user.setGender(MotechConstants.GENDER_UNKNOWN_OPENMRS); PersonName name = new PersonName(webStaff.getFirstName(), null, webStaff.getLastName()); user.addName(nam... |
### Question:
StaffMessageServiceImpl implements StaffMessageService { boolean isMessageTimeWithinBlackoutPeriod(Date deliveryDate) { Date checkForDate = (deliveryDate != null ? deliveryDate : new Date()); Blackout blackout = motechService().getBlackoutSettings(); if (blackout == null) { return false; } Calendar blacko... |
### Question:
MotechUserRepository { public MotechUserTypes userTypes() { return motechUsers.types(); } MotechUserRepository(IdentifierGenerator identifierGenerator, UserService userService, PersonService personService, MotechUsers motechUsers); User newUser(WebStaff webStaff); User updateUser(User staff, WebStaff webS... |
### Question:
DemoPatientController extends BasePatientController { @ModelAttribute("regions") public List<String> getRegions() { return JSONLocationSerializer.getAllRegions(); } @Autowired void setContextService(ContextService contextService); void setRegistrarBean(RegistrarBean registrarBean); void setWebModelConver... |
### Question:
DemoPatientController extends BasePatientController { @ModelAttribute("districts") public List<String> getDistricts() { return JSONLocationSerializer.getAllDistricts(); } @Autowired void setContextService(ContextService contextService); void setRegistrarBean(RegistrarBean registrarBean); void setWebModel... |
### Question:
DemoPatientController extends BasePatientController { @ModelAttribute("communities") public List<Community> getCommunities() { return JSONLocationSerializer.getAllCommunities(false); } @Autowired void setContextService(ContextService contextService); void setRegistrarBean(RegistrarBean registrarBean); vo... |
### Question:
FacilityController { @RequestMapping(value = "/module/motechmodule/addfacility.form", method = RequestMethod.GET) public String viewAddFacilityForm(ModelMap modelMap){ populateLocation(modelMap); modelMap.addAttribute("facility", new WebFacility()); return "/module/motechmodule/addfacility"; } FacilityCon... |
### Question:
FacilityController { @RequestMapping(value = "/module/motechmodule/addfacility.form", method = RequestMethod.POST) public String submitAddFacility(@ModelAttribute("facility") WebFacility facility, Errors errors,ModelMap modelMap, SessionStatus status){ if(contextService.getMotechService().getLocationByNam... |
### Question:
SMSController { @RequestMapping(value = VIEW, method = RequestMethod.GET) public ModelAndView render() { ModelAndView modelAndView = new ModelAndView(VIEW, "bulkMessage", new WebBulkMessage()); locationSerializer.populateJavascriptMaps(modelAndView.getModelMap()); return modelAndView; } @RequestMapping(v... |
### Question:
StaffController { @RequestMapping(method = RequestMethod.POST) public String registerStaff(@ModelAttribute("staff") WebStaff staff, Errors errors, ModelMap model) { log.debug("Register Staff"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "motechmodule.firstName.required"); ValidationUti... |
### Question:
AuthenticationServiceImpl implements AuthenticationService { public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } AuthenticationServiceImpl(ContextService contextService); User getAuthenticatedUser(); }### Answer:
@Test public void shouldDelegateCallToContextService(){ Aut... |
### Question:
SupportCaseExtractionStrategy implements MessageContentExtractionStrategy { public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); Strin... |
### Question:
Password { public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); } Password(Integer length); String create(); }### Answer:
@Test public void cre... |
### Question:
DateUtil { public boolean isSameMonth(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.MONTH) == otherCalendar.get(Calendar.MONTH); } boolean isSameMonth(Date date, Date otherDate); boolean isSameYear(Date da... |
### Question:
DateUtil { public boolean isSameYear(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR); } boolean isSameMonth(Date date, Date otherDate); boolean isSameYear(Date date,... |
### Question:
DateUtil { public Calendar getCalendarWithTime(int hourOfTheDay, int minutes, int seconds) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, hourOfTheDay); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, seconds); return calendar; } boolean isSameMonth... |
### Question:
CareConfiguration { public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } CareConfiguration(); CareConfiguration(Long id, String name, Integer maxAlertsToBeSent); Boolean canAlertBeSent(Integer alertCount); }### Answer:
@Test public void shouldCheckWhetherMaximumA... |
### Question:
RegistrationRequirement implements Requirement { public boolean meetsRequirement(Patient patient, Date date) { Date childRegistrationDate = registrarBean.getChildRegistrationDate(); List<Encounter> encounters = registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.ge... |
### Question:
HttpClient implements WebClient { public Response get(String fromUrl) { DefaultHttpClient client = new DefaultHttpClient(); try { HttpResponse httpResponse = client.execute(new HttpGet(fromUrl)); return new WebResponse(httpResponse).read(); } catch (IOException e) { return new Response(MailingConstants.ME... |
### Question:
MailingServiceImpl implements MailingService { public void send(Email mail) { SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setTo(mail.to()); mailMessage.setFrom(mail.from()); mailMessage.setSubject(mail.subject()); mailMessage.setText(mail.text()); mailSenderFactory.mailSender().se... |
### Question:
PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
RegistrantType reg... |
### Question:
TokenReloadCrumbExclusion extends CrumbExclusion { @Override public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (TokenReloadAction.tokenReloadEnabled()) { String pathInfo = request.getPathInfo(); if (pathInfo != nul... |
### Question:
PrimitiveConfigurator implements Configurator { @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } Primitive... |
### Question:
StaticFieldExporter { @Deprecated public static void export(Module module, List<Class<?>> classesToConvert) { new StaticFieldExporter(module, null).export(classesToConvert); } StaticFieldExporter(Module module, Configuration conf); @Deprecated static void export(Module module, List<Class<?>> classesToConv... |
### Question:
SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } void parse(Reader in); List<String> getStatements(); static List<String> statementsFrom(Reader reader); static List<String> statementsFr... |
### Question:
AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); vo... |
### Question:
RuntimeSampler { public static GsonBuilder gsonBuilder() { return new GsonBuilder() .serializeNulls() .setExclusionStrategies(new ExclusionStrategy() { @Override public boolean shouldSkipField(FieldAttributes fieldAttributes) { return false; } @Override public boolean shouldSkipClass(Class<?> aClass) { re... |
### Question:
RuntimeSampler { public static JsonbConfig jsonbConfig() { return new JsonbConfig() .withNullValues(true) .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return false; } @Override public boolean isVisible(Method method) { return false; }... |
### Question:
AllDateTypes { public Date getDate() { return date; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); void setDayOfWeek... |
### Question:
AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); vo... |
### Question:
AllDateTypes { public LocalDateTime getLocalDateTime() { return localDateTime; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDay... |
### Question:
AllDateTypes { public LocalTime getLocalTime() { return localTime; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); vo... |
### Question:
RuntimeSampler { public static ObjectMapper objectMapper() { return new ObjectMapper() .setDefaultPropertyInclusion(JsonInclude.Include.ALWAYS) .setDefaultVisibility(JsonAutoDetect.Value.construct(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.PROTECTED_AND_PUBLIC)) .configure(MapperFeature.SORT_PROPER... |
### Question:
MatrixChecker { static void verifyArrays(@NonNull double[][] arrays) { checkNotNull(arrays); final int m = arrays.length; checkExpression(m > 0, "Row should be positive"); final int n = arrays[0].length; for (int i = 1; i < m; ++i) { checkExpression(arrays[i].length == n, "All rows must have the same leng... |
### Question:
Matrix implements Serializable { public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col)... |
### Question:
Matrix implements Serializable { public Matrix copy() { final double[] array = mArray.clone(); return Matrix.array(array, mRow); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.