target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void registerStaff() { RegistrarBean registrarBean = createMock(RegistrarBean.class); Errors errors = createMock(Errors.class); StaffController controller = new StaffController(); controller.setRegistrarBean(registrarBean); ModelMap map = new ModelMap(); WebStaff staff = new WebStaff(); staff.setFirstName(... | @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"); ValidationUtils.rejectIfEmptyOrWhitespace(err... | 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"); ValidationUtils.rejectIfEmp... | 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"); ValidationUtils.rejectIfEmp... | 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"); ValidationUtils.rejectIfEmp... | 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"); ValidationUtils.rejectIfEmp... |
@Test public void shouldDelegateCallToContextService(){ AuthenticationServiceImpl service = new AuthenticationServiceImpl(contextService); User user = new User(); when(contextService.getAuthenticatedUser()).thenReturn(user); User authenticatedUser = service.getAuthenticatedUser(); verify(contextService).getAuthenticate... | public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } | AuthenticationServiceImpl implements AuthenticationService { public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } } | AuthenticationServiceImpl implements AuthenticationService { public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } AuthenticationServiceImpl(ContextService contextService); } | AuthenticationServiceImpl implements AuthenticationService { public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } AuthenticationServiceImpl(ContextService contextService); User getAuthenticatedUser(); } | AuthenticationServiceImpl implements AuthenticationService { public User getAuthenticatedUser() { return contextService.getAuthenticatedUser(); } AuthenticationServiceImpl(ContextService contextService); User getAuthenticatedUser(); } |
@Test public void shouldExtractMessageContent() throws ParseException, MessageContentExtractionException { SupportCaseExtractionStrategy strategy = new SupportCaseExtractionStrategy(); IncomingMessage message = new IncomingMessage(); message.setKey(" SUPPORT"); message.setTime("2011-06-25 09:30:29 "); message.setText("... | public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); String description = message.extractDescriptionWith(this); return new SupportCase(sender,phoneN... | SupportCaseExtractionStrategy implements MessageContentExtractionStrategy { public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); String description ... | SupportCaseExtractionStrategy implements MessageContentExtractionStrategy { public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); String description ... | SupportCaseExtractionStrategy implements MessageContentExtractionStrategy { public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); String description ... | SupportCaseExtractionStrategy implements MessageContentExtractionStrategy { public SupportCase extractFrom(IncomingMessage message) { try { String dateRaisedOn = message.extractDateWith(this); String phoneNumber = message.extractPhoneNumberWith(this); String sender = message.extractSenderWith(this); String description ... |
@Test public void createPasswordWithSpecifiedLength(){ String password = new Password(10).create(); assertNotNull(password); assertEquals(10,password.length()); } | 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 { 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 { 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); } | 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(); } | 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(); } |
@Test public void isSameMonth() { assertTrue(dateUtil.isSameMonth(new Date(), new Date())); } | public boolean isSameMonth(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.MONTH) == otherCalendar.get(Calendar.MONTH); } | 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); } } | 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); } } | 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 date, Date other... | 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 date, Date other... |
@Test public void isNotSameMonth() { assertFalse(dateUtil.isSameMonth(new Date(), DateUtils.addMonths(new Date(), -1))); } | public boolean isSameMonth(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.MONTH) == otherCalendar.get(Calendar.MONTH); } | 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); } } | 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); } } | 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 date, Date other... | 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 date, Date other... |
@Test public void isSameYear() { assertTrue(dateUtil.isSameYear(new Date(), new Date())); } | public boolean isSameYear(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR); } | 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); } } | 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); } } | 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, Date otherDat... | 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, Date otherDat... |
@Test public void isNotSameYear() { assertFalse(dateUtil.isSameYear(new Date(), DateUtils.addYears(new Date(), -1))); } | public boolean isSameYear(Date date, Date otherDate) { Calendar calendar = calendarFor(date); Calendar otherCalendar = calendarFor(otherDate); return calendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR); } | 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); } } | 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); } } | 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, Date otherDat... | 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, Date otherDat... |
@Test @SkipBaseSetup public void testSingleNotify() { try { Context.openSession(); Context.authenticate("admin", "test"); RegistrarBean registrarBean = Context.getService(MotechService.class) .getRegistrarBean(); Date date = new Date(); Integer motherMotechId = 1234649; Facility facility = registrarBean.getFacilityById... | @Override public void execute() { long start = System.currentTimeMillis(); log.info("executing task"); String timeOffsetString = this.taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_TIME_OFFSET); Boolean sendImmediate = Boolean.valueOf(taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_SEND_IMMEDIATE))... | NotificationTask extends AbstractTask { @Override public void execute() { long start = System.currentTimeMillis(); log.info("executing task"); String timeOffsetString = this.taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_TIME_OFFSET); Boolean sendImmediate = Boolean.valueOf(taskDefinition .getProperty(Motech... | NotificationTask extends AbstractTask { @Override public void execute() { long start = System.currentTimeMillis(); log.info("executing task"); String timeOffsetString = this.taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_TIME_OFFSET); Boolean sendImmediate = Boolean.valueOf(taskDefinition .getProperty(Motech... | NotificationTask extends AbstractTask { @Override public void execute() { long start = System.currentTimeMillis(); log.info("executing task"); String timeOffsetString = this.taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_TIME_OFFSET); Boolean sendImmediate = Boolean.valueOf(taskDefinition .getProperty(Motech... | NotificationTask extends AbstractTask { @Override public void execute() { long start = System.currentTimeMillis(); log.info("executing task"); String timeOffsetString = this.taskDefinition .getProperty(MotechConstants.TASK_PROPERTY_TIME_OFFSET); Boolean sendImmediate = Boolean.valueOf(taskDefinition .getProperty(Motech... |
@Test public void shouldReturnCalendarWithGivenTime() { Calendar calendar = dateUtil.getCalendarWithTime(10, 50, 20); assertNotNull(calendar); assertEquals(10, calendar.get(Calendar.HOUR_OF_DAY)); assertEquals(50, calendar.get(Calendar.MINUTE)); assertEquals(20, calendar.get(Calendar.SECOND)); } | 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; } | 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; } } | 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; } } | 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(Date date, Da... | 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(Date date, Da... |
@Test public void shouldCheckWhetherMaximumAlertsHaveBeenSent() { CareConfiguration careConfiguration = new CareConfiguration(1L, "ANC", 4); assertTrue(careConfiguration.canAlertBeSent(1)); assertTrue(careConfiguration.canAlertBeSent(2)); assertFalse(careConfiguration.canAlertBeSent(4)); assertFalse(careConfiguration.c... | public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } | CareConfiguration { public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } } | CareConfiguration { public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } CareConfiguration(); CareConfiguration(Long id, String name, Integer maxAlertsToBeSent); } | CareConfiguration { public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } CareConfiguration(); CareConfiguration(Long id, String name, Integer maxAlertsToBeSent); Boolean canAlertBeSent(Integer alertCount); } | CareConfiguration { public Boolean canAlertBeSent(Integer alertCount) { return alertCount < maxAlertsToBeSent ; } CareConfiguration(); CareConfiguration(Long id, String name, Integer maxAlertsToBeSent); Boolean canAlertBeSent(Integer alertCount); } |
@Test public void shouldReturnTrueWhenPatientIsRegisteredAfterValidDate() { Calendar cal = Calendar.getInstance(); cal.set(2000, 1, 1); Date birthDate = cal.getTime(); cal.set(2011, 4, 19); Date validRegDate = cal.getTime(); cal.set(2011, 5, 19); Date encounterDate = cal.getTime(); Patient patient = new Patient(); pati... | public boolean meetsRequirement(Patient patient, Date date) { Date childRegistrationDate = registrarBean.getChildRegistrationDate(); List<Encounter> encounters = registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate()); if (encounters == null || encounters.isEmpty()) ... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... |
@Test public void shouldReturnFalseWhenPatientIsRegisteredBeforeValidDate() { Calendar cal = Calendar.getInstance(); cal.set(2000, 1, 1); Date birthDate = cal.getTime(); cal.set(2011, 4, 19); Date validRegDate = cal.getTime(); cal.set(2011, 3, 19); Date encounterDate = cal.getTime(); Patient patient = new Patient(); pa... | public boolean meetsRequirement(Patient patient, Date date) { Date childRegistrationDate = registrarBean.getChildRegistrationDate(); List<Encounter> encounters = registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate()); if (encounters == null || encounters.isEmpty()) ... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... |
@Test public void shouldReturnFalseIfNoEncountersArePresentForPatient() { Calendar cal = Calendar.getInstance(); cal.set(2000, 1, 1); Date birthDate = cal.getTime(); cal.set(2011, 4, 19); Date validRegDate = cal.getTime(); cal.set(2011, 3, 19); Date encounterDate = cal.getTime(); Patient patient = new Patient(); patien... | public boolean meetsRequirement(Patient patient, Date date) { Date childRegistrationDate = registrarBean.getChildRegistrationDate(); List<Encounter> encounters = registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate()); if (encounters == null || encounters.isEmpty()) ... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... | 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.getBirthdate());... |
@Ignore("Should be an integration test") @Test public void shouldMakeAHttpGetRequest() { HttpClient client = new HttpClient(); Response response = client.get("http: "text=support+465+Connection+Broken&number=%2B233123456789" + "&key=support&code=1982&time=2011-01-01+10:10:10"); assertEquals("Welcome to MOTECH. Your mes... | 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.MESSAGE_PROCESSING_FAILED); } } | 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.MESSAGE_PROCESSI... | 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.MESSAGE_PROCESSI... | 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.MESSAGE_PROCESSI... | 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.MESSAGE_PROCESSI... |
@Test public void shouldEmail() { MailSenderFactory mailSenderFactory = createMock(MailSenderFactory.class); JavaMailSender sender = createMock(JavaMailSender.class); expect(mailSenderFactory.mailSender()).andReturn(sender); sender.send(equalsMessage(expectedMessage())); expectLastCall(); Email mail = new Email("abc@ab... | 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().send(mailMessage); } | 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().send(mailMessage... | 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().send(mailMessage... | 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().send(mailMessage... | 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().send(mailMessage... |
@Test public void shouldNotAddPatientToCommunityWhenCommunityIsNotSet() { Community community = mock(Community.class); Patient patient = builder.build(); verify(community, never()).add(patient); } | public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } | PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } } | PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
RegistrantType registrantType, P... | PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
RegistrantType registrantType, P... | PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
RegistrantType registrantType, P... |
@Test public void testGetAllDuplicatePatients() throws Exception { MotechService motechService = Context.getService(MotechService.class); assertEquals(2, motechService.getAllDuplicatePatients().size()); } | public List<Patient> getAllDuplicatePatients() { return motechDAO.getAllDuplicatePatients(); } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public List<Patient> getAllDuplicatePatients() { return motechDAO.getAllDuplicatePatients(); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public List<Patient> getAllDuplicatePatients() { return motechDAO.getAllDuplicatePatients(); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public List<Patient> getAllDuplicatePatients() { return motechDAO.getAllDuplicatePatients(); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean registrarBean); ... | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public List<Patient> getAllDuplicatePatients() { return motechDAO.getAllDuplicatePatients(); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean registrarBean); ... |
@Test public void shouldGetFacilityForPatient() { MotechService motechService = Context.getService(MotechService.class); Patient patient = new org.openmrs.Patient(); patient.setId(1); Facility facility = motechService.facilityFor(patient); assertNotNull(facility); } | public Facility facilityFor(Patient patient) { return motechDAO.facilityFor(patient); } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public Facility facilityFor(Patient patient) { return motechDAO.facilityFor(patient); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public Facility facilityFor(Patient patient) { return motechDAO.facilityFor(patient); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public Facility facilityFor(Patient patient) { return motechDAO.facilityFor(patient); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean registrarBean); Openmrs... | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public Facility facilityFor(Patient patient) { return motechDAO.facilityFor(patient); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean registrarBean); Openmrs... |
@Test public void shouldFetchAllMotechConfiguration() { MotechService motechService = Context.getService(MotechService.class); MotechConfiguration motechConfiguration = motechService.getConfigurationFor("valid.child.registration.date"); assertNotNull(motechConfiguration); assertNotNull(motechConfiguration.asDate()); } | public MotechConfiguration getConfigurationFor(String name) { return motechDAO.getConfiguration(name); } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public MotechConfiguration getConfigurationFor(String name) { return motechDAO.getConfiguration(name); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public MotechConfiguration getConfigurationFor(String name) { return motechDAO.getConfiguration(name); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public MotechConfiguration getConfigurationFor(String name) { return motechDAO.getConfiguration(name); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean regist... | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public MotechConfiguration getConfigurationFor(String name) { return motechDAO.getConfiguration(name); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void setRegistrarBean(RegistrarBean regist... |
@Test public void shouldRetrieveExpectedEncounterAlert() { MotechService motechService = Context.getService(MotechService.class); ExpectedEncounter expectedEncounter = new ExpectedEncounter(); expectedEncounter.setId(1l); DefaultedExpectedEncounterAlert alert = motechService.getDefaultedEncounterAlertFor(expectedEncoun... | public DefaultedExpectedEncounterAlert getDefaultedEncounterAlertFor(ExpectedEncounter expectedEncounter) { return motechDAO.getDefaultedEncounterAlertFor(expectedEncounter); } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedEncounterAlert getDefaultedEncounterAlertFor(ExpectedEncounter expectedEncounter) { return motechDAO.getDefaultedEncounterAlertFor(expectedEncounter); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedEncounterAlert getDefaultedEncounterAlertFor(ExpectedEncounter expectedEncounter) { return motechDAO.getDefaultedEncounterAlertFor(expectedEncounter); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedEncounterAlert getDefaultedEncounterAlertFor(ExpectedEncounter expectedEncounter) { return motechDAO.getDefaultedEncounterAlertFor(expectedEncounter); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); Regi... | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedEncounterAlert getDefaultedEncounterAlertFor(ExpectedEncounter expectedEncounter) { return motechDAO.getDefaultedEncounterAlertFor(expectedEncounter); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); Regi... |
@Test public void shouldRetrieveExpectedObsAlert() { MotechService motechService = Context.getService(MotechService.class); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setId(1l); DefaultedExpectedObsAlert alert = motechService.getDefaultedObsAlertFor(expectedObs); assertNotNull(alert); assertTrue(alert.isF... | public DefaultedExpectedObsAlert getDefaultedObsAlertFor(ExpectedObs expectedObs) { return motechDAO.getDefaultedObsAlertFor(expectedObs); } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedObsAlert getDefaultedObsAlertFor(ExpectedObs expectedObs) { return motechDAO.getDefaultedObsAlertFor(expectedObs); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedObsAlert getDefaultedObsAlertFor(ExpectedObs expectedObs) { return motechDAO.getDefaultedObsAlertFor(expectedObs); } } | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedObsAlert getDefaultedObsAlertFor(ExpectedObs expectedObs) { return motechDAO.getDefaultedObsAlertFor(expectedObs); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void s... | MotechServiceImpl extends BaseOpenmrsService implements MotechService { public DefaultedExpectedObsAlert getDefaultedObsAlertFor(ExpectedObs expectedObs) { return motechDAO.getDefaultedObsAlertFor(expectedObs); } MotechDAO getMotechDAO(); void setMotechDAO(MotechDAO motechDAO); RegistrarBean getRegistrarBean(); void s... |
@Test public void resolve_singleEntry() { environment.set("FOO", "hello"); assertThat(resolve("${FOO}"), equalTo("hello")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_multipleEntriesEscaped() { assertThat(resolve("^${FOO}:^${BAR}"), equalTo("${FOO}:${BAR}")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_nothing() { assertThat(resolve("FOO"), equalTo("FOO")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_empty() { assertThat(resolve(""), equalTo("")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_blank() { assertThat(resolve(" "), equalTo(" ")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_nothingSpace() { assertThat(resolve("${ }"), equalTo("")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_nothingBrackets() { assertThat(resolve("${}"), equalTo("")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_nothingDefault() { assertThat(resolve("${:-default}"), equalTo("default")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_emptyDefault() { assertThat(resolve("${FOO:-}"), equalTo("")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_emptyDefaultEnvDefined() { environment.set("FOO", "foo"); assertThat(resolve("${FOO:-}"), equalTo("foo")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_defaultValueLimit() { assertThat(resolve("${FOO:-default:-other}"), equalTo("default:-other")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_singleEntryWithoutDefaultValue() { assertThat(resolve("${FOO}"), equalTo("")); assertTrue(logContains("Configuration import: Found unresolved variable 'FOO'")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedSingleEntry() { environment.set("FOO", "www.foo.io"); assertThat(resolve("http: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedSingleEntryWithDefault() { environment.set("FOO", "www.foo.io"); assertThat(resolve("${protocol:-https}: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedSingleEntryEscaped() { assertThat(resolve("http: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedMultipleEntries() { environment.set("FOO", "www.foo.io"); environment.set("BAR", "8080"); assertThat(resolve("http: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedMultipleEntriesWithDefault() { environment.set("FOO", "www.foo.io"); environment.set("protocol", "http"); assertThat(resolve("${protocol:-https}: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_noInterpolatorStringLookupForARegularFileOrBase64Variable() { environment.set("base64", "foo"); environment.set("file", "foo"); assertThat(resolve("${base64}"), equalTo("foo")); assertThat(resolve("${file}"), equalTo("foo")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_mixedMultipleEntriesEscaped() { assertThat(resolve("http: } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_Base64() { String input = "Hello World"; String output = resolve("${base64:" + input + "}"); assertThat(output, equalTo(ENCODE.lookup(input))); assertThat(DECODE.lookup(output), equalTo(input)); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_Base64NestedEnv() { String input = "Hello World"; environment.set("FOO", input); String output = resolve("${base64:${FOO}}"); assertThat(output, equalTo(ENCODE.lookup(input))); assertThat(DECODE.lookup(output), equalTo(input)); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_File() throws Exception { String input = getPath("secret.json").toAbsolutePath().toString(); String output = resolve("${readFile:" + input + "}"); assertThat(output, equalTo(FILE.lookup(input))); assertThat(output, containsString("\"Our secret\": \"Hello World\"")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_singleEntryWithDefaultValue() { assertThat(resolve("${FOO:-default}"), equalTo("default")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileWithRelative() throws Exception { Path path = getPath("secret.json"); String input = Paths.get("").toUri().relativize(path.toUri()).getPath(); String output = resolve("${readFile:" + input + "}"); assertThat(output, equalTo(FILE.lookup(input))); assertThat(output, containsString("\"Our sec... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileWithSpace() throws Exception { String path = getPath("some secret.json").toAbsolutePath().toString(); String output = resolve("${readFile:" + path + "}"); assertThat(output, equalTo(FILE.lookup(path))); assertThat(output, containsString("\"Our secret\": \"Hello World\"")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileWithSpaceAndRelative() throws Exception { String path = getPath("some secret.json").toAbsolutePath().toString(); String input = Paths.get("").toUri().relativize(new File(path).toURI()).getPath(); String output = resolve("${readFile:" + input + "}"); assertThat(output, equalTo(FILE.lookup(i... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileBase64() throws Exception { String input = getPath("secret.json").toAbsolutePath().toString(); String output = resolve("${base64:${readFile:" + input + "}}"); String decoded = DECODE.lookup(output); String content = FILE.lookup(input); assertThat(output, equalTo(ENCODE.lookup(content))); a... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileBase64NestedEnv() throws Exception { String input = getPath("secret.json").toAbsolutePath().toString(); environment.set("FOO", input); String output = resolve("${base64:${readFile:${FOO}}}"); String decoded = DECODE.lookup(output); String content = FILE.lookup(input); assertThat(output, eq... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileNotFound() { resolve("${readFile:./hello-world-not-found.txt}"); assertTrue(logContains("Configuration import: Error looking up file './hello-world-not-found.txt' with UTF-8 encoding.")); assertTrue(logContains("Configuration import: Found unresolved variable 'readFile:./hello-world-not-fo... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_FileBase64NotFound() { resolve("${readFileBase64:./hello-world-not-found.txt}"); assertTrue(logContains("Configuration import: Error looking up file './hello-world-not-found.txt'.")); assertTrue(logContains("Configuration import: Found unresolved variable 'readFileBase64:./hello-world-not-foun... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_BinaryFileBase64() throws Exception { Path path = getPath("secret.json"); String pathStr = path.toAbsolutePath().toString(); environment.set("FOO", pathStr); byte[] bytes = Files.readAllBytes(path); String expected = Base64.getEncoder().encodeToString(bytes); byte[] expectedBytes = Base64.getD... | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void crumbExclusionIsDisabledByDefault() throws Exception { System.clearProperty("casc.reload.token"); TokenReloadCrumbExclusion crumbExclusion = new TokenReloadCrumbExclusion(); assertFalse(crumbExclusion.process(newRequestWithPath("/reload-configuration-as-code/"), null, null)); } | @Override public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (TokenReloadAction.tokenReloadEnabled()) { String pathInfo = request.getPathInfo(); if (pathInfo != null && pathInfo.equals("/" + TokenReloadAction.URL_NAME + "/")) { c... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... |
@Test public void crumbExclusionChecksRequestPath() throws Exception { System.setProperty("casc.reload.token", "someSecretValue"); TokenReloadCrumbExclusion crumbExclusion = new TokenReloadCrumbExclusion(); assertFalse(crumbExclusion.process(newRequestWithPath("/reload-configuration-as-code/2"), null, null)); } | @Override public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (TokenReloadAction.tokenReloadEnabled()) { String pathInfo = request.getPathInfo(); if (pathInfo != null && pathInfo.equals("/" + TokenReloadAction.URL_NAME + "/")) { c... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... |
@Test public void resolve_singleEntryWithDefaultValueAndWithEnvDefined() { environment.set("FOO", "hello"); assertThat(resolve("${FOO:-default}"), equalTo("hello")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void crumbExclustionAllowsReloadIfEnabledAndRequestPathMatch() throws Exception { System.setProperty("casc.reload.token", "someSecretValue"); TokenReloadCrumbExclusion crumbExclusion = new TokenReloadCrumbExclusion(); AtomicBoolean callProcessed = new AtomicBoolean(false); assertTrue(crumbExclusion.process... | @Override public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (TokenReloadAction.tokenReloadEnabled()) { String pathInfo = request.getPathInfo(); if (pathInfo != null && pathInfo.equals("/" + TokenReloadAction.URL_NAME + "/")) { c... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... | 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 != null && pathInfo.... |
@Test public void _boolean() throws Exception { Configurator c = registry.lookupOrFail(boolean.class); final Object value = c.configure(new Scalar("true"), context); assertTrue((Boolean) value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _int() throws Exception { Configurator c = registry.lookupOrFail(int.class); final Object value = c.configure(new Scalar("123"), context); assertEquals(123, (int) value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _Integer() throws Exception { Configurator c = registry.lookupOrFail(Integer.class); final Object value = c.configure(new Scalar("123"), context); assertEquals(123, (int) value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _string() throws Exception { Configurator c = registry.lookupOrFail(String.class); final Object value = c.configure(new Scalar("abc"), context); assertEquals("abc", value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _enum() throws Exception { Configurator<Node.Mode> c = registry.lookupOrFail(Node.Mode.class); final Node.Mode value = c.configure(new Scalar("NORMAL"), context); assertEquals(Node.Mode.NORMAL, value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _enum2() throws Exception { Configurator<TimeUnit> c = registry.lookupOrFail(TimeUnit.class); final TimeUnit value = c.configure(new Scalar("DAYS"), context); assertEquals(TimeUnit.DAYS, value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _Integer_env() throws Exception { environment.set("ENV_FOR_TEST", "123"); Configurator c = registry.lookupOrFail(Integer.class); final Object value = c.configure(new Scalar("${ENV_FOR_TEST}"), context); assertEquals(123, (int) value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _string_env() throws Exception { environment.set("ENV_FOR_TEST", "abc"); Configurator c = registry.lookupOrFail(String.class); final Object value = c.configure(new Scalar("${ENV_FOR_TEST}"), context); assertEquals("abc", value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void _string_env_default() throws Exception { environment.set("NOT_THERE", "abc"); Configurator c = registry.lookupOrFail(String.class); final Object value = c.configure(new Scalar("${ENV_FOR_TEST:-unsecured-token}"), context); assertEquals("unsecured-token", value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void resolve_singleEntryEscaped() { assertThat(resolve("^${FOO}"), equalTo("${FOO}")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void _int_env_default() throws Exception { Configurator c = registry.lookupOrFail(Integer.class); final Object value = c.configure(new Scalar("${ENV_FOR_TEST:-123}"), context); assertEquals(123, value); } | @NonNull @Override public Object configure(CNode config, ConfigurationContext context) throws ConfiguratorException { return Stapler.lookupConverter(target).convert(target, context.getSecretSourceResolver().resolve(config.asScalar().toString())); } | 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())); } } | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... | 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())); } PrimitiveConfigurator(C... |
@Test public void resolve_singleEntryDoubleEscaped() { assertThat(resolve("^^${FOO}"), equalTo("^${FOO}")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_multipleEntries() { environment.set("FOO", "hello"); environment.set("BAR", "world"); assertThat(resolve("${FOO}:${BAR}"), equalTo("hello:world")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_multipleEntriesWithoutDefaultValue() { assertThat(resolve("${FOO}:${BAR}"), equalTo(":")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_multipleEntriesWithDefaultValue() { assertThat(resolve("${FOO:-hello}:${BAR:-world}"), equalTo("hello:world")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void resolve_multipleEntriesWithDefaultValueAndEnvDefined() { environment.set("FOO", "hello"); environment.set("BAR", "world"); assertThat(resolve("${FOO:-default}:${BAR:-default}"), equalTo("hello:world")); } | @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); } | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... | SecretSourceResolver { @Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); } SecretSourceResolver(ConfigurationContext configurationContext); String encode(@CheckForNull String toEncod... |
@Test public void testTypeScriptDefinition() throws IOException, IllegalArgumentException { Writer out = new StringWriter(); ArrayList<Class<?>> classesToConvert = new ArrayList<Class<?>>(); classesToConvert.add(TestClass.class); Module module = new Module("mod"); new StaticFieldExporter(module, null).export(classesToC... | @Deprecated public static void export(Module module, List<Class<?>> classesToConvert) { new StaticFieldExporter(module, null).export(classesToConvert); } | StaticFieldExporter { @Deprecated public static void export(Module module, List<Class<?>> classesToConvert) { new StaticFieldExporter(module, null).export(classesToConvert); } } | StaticFieldExporter { @Deprecated public static void export(Module module, List<Class<?>> classesToConvert) { new StaticFieldExporter(module, null).export(classesToConvert); } StaticFieldExporter(Module module, Configuration conf); } | 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<?>> classesToConvert); void exp... | 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<?>> classesToConvert); void exp... |
@Test public void testReadMultiLineCommand() throws IOException { String firstLine = "CREATE TABLE 'testTable'"; String secondLine = "_id INTEGER PRIMARY KEY AUTOINCREMENT;"; String singleLineCommand = firstLine + " " + secondLine; String multiLineCommand = firstLine + "\n" + secondLine; List<String> statementsFromMult... | public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } | SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } } | SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } } | 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> statementsFrom(File sqlfil... | 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> statementsFrom(File sqlfil... |
@Test public void testSkippingTrailingComments() throws IOException { String rawLine = "CREATE TABLE 'testTable'"; String comment = "-- adding some comment that should get stripped off"; String nextLine = "_id INTEGER PRIMARY KEY AUTOINCREMENT;"; String lineCommand = rawLine + comment + "\n" + nextLine; List<String> st... | public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } | SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } } | SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); } } | 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> statementsFrom(File sqlfil... | 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> statementsFrom(File sqlfil... |
@Test public void givenLocalDate_shouldSerialize() throws ParseException { String expectedJson = "{\"year\":2017,\"month\":12,\"day\":25}"; String actualJson = new GsonBuilder().create().toJson(new AllDateTypes().getLocalDate()); assertThat(actualJson).isEqualTo(expectedJson); } | public LocalDate getLocalDate() { return localDate; } | AllDateTypes { public LocalDate getLocalDate() { return localDate; } } | AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); } | 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(); void setDayOfWee... | 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(); void setDayOfWee... |
@Test public void test_using_gsonBuilder() { String expectedJson = "{\n" + " \"byteprimitive\": 0,\n" + " \"shortprimitive\": 0,\n" + " \"charprimitive\": \"\\u0000\",\n" + " \"intprimitive\": 0,\n" + " \"longprimitive\": 0,\n" + " \"floatprimitive\": 0.0,\n" + " \"doubleprimitive\": 0.0,\n" + " \"aboolean\": false,\n"... | 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) { return false; } }) .excludeFields... | 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) { return false; } ... | 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) { return false; } ... | 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) { return false; } ... | 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) { return false; } ... |
@Test public void test_using_jsonbConfig() { String expectedJson = "\n" + "{\n" + " \"string\": null,\n" + " \"shortWrapper\": null,\n" + " \"shortPrimitive\": null,\n" + " \"longWrapper\": null,\n" + " \"longPrimitive\": null,\n" + " \"intWrapper\": null,\n" + " \"intPrimitive\": null,\n" + " \"floatWrapper\": null,\n... | 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; } }) .withPropertyNamingStrategy... | 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; } }) .withPrope... | 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; } }) .withPrope... | 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; } }) .withPrope... | 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; } }) .withPrope... |
@Test public void givenDate_shouldSerialize() throws ParseException, JsonProcessingException { String expectedJson = "1514160000000"; String actualJson = new ObjectMapper().writeValueAsString(new AllDateTypes().getDate()); assertThat(actualJson).isEqualTo(expectedJson); } | public Date getDate() { return date; } | AllDateTypes { public Date getDate() { return date; } } | AllDateTypes { public Date getDate() { return date; } AllDateTypes(); } | 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(DayOfWeek day... | 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(DayOfWeek day... |
@Test public void givenLocalDate_shouldSerialize() throws ParseException, JsonProcessingException { String expectedJson = "{\"year\":2017,\"month\":\"DECEMBER\",\"chronology\":{\"id\":\"ISO\",\"calendarType\":\"iso8601\"},\"dayOfMonth\":25,\"dayOfWeek\":\"MONDAY\",\"dayOfYear\":359,\"leapYear\":false,\"monthValue\":12,... | public LocalDate getLocalDate() { return localDate; } | AllDateTypes { public LocalDate getLocalDate() { return localDate; } } | AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); } | 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(); void setDayOfWee... | 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(); void setDayOfWee... |
@Test public void givenLocalDateTime_shouldSerialize() throws ParseException, JsonProcessingException { String expectedJson = "{\"hour\":0,\"minute\":0,\"nano\":0,\"second\":0,\"dayOfMonth\":25,\"dayOfWeek\":\"MONDAY\",\"dayOfYear\":359,\"month\":\"DECEMBER\",\"monthValue\":12,\"year\":2017,\"chronology\":{\"id\":\"ISO... | public LocalDateTime getLocalDateTime() { return localDateTime; } | AllDateTypes { public LocalDateTime getLocalDateTime() { return localDateTime; } } | AllDateTypes { public LocalDateTime getLocalDateTime() { return localDateTime; } AllDateTypes(); } | 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 getDayOfWeek(); void... | 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 getDayOfWeek(); void... |
@Test public void givenLocalTime_shouldSerialize() throws ParseException, JsonProcessingException { String expectedJson = "{\"hour\":23,\"minute\":0,\"second\":0,\"nano\":0}"; String actualJson = new ObjectMapper().writeValueAsString(new AllDateTypes().getLocalTime()); assertThat(actualJson).isEqualTo(expectedJson); } | public LocalTime getLocalTime() { return localTime; } | AllDateTypes { public LocalTime getLocalTime() { return localTime; } } | AllDateTypes { public LocalTime getLocalTime() { return localTime; } AllDateTypes(); } | 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(); void setDayOfWee... | 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(); void setDayOfWee... |
@Test public void test_using_customised_objectMapper() throws IOException { String expectedJson = "{\"aBoolean\":false,\"booleanWrapper\":false,\"bytePrimitive\":0,\"byteWrapper\":0,\"charPrimitive\":\"\\u0000\",\"charWrapper\":\"\\u0000\",\"doublePrimitive\":0.0,\"doubleWrapper\":0.0,\"floatPrimitive\":0.0,\"floatWrap... | 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_PROPERTIES_ALPHABETICALLY, true) .set... | 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_PROPERTIES_ALPHABETI... | 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_PROPERTIES_ALPHABETI... | 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_PROPERTIES_ALPHABETI... | 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_PROPERTIES_ALPHABETI... |
@Test public void testVerifyArrays() { final double[][] arrays = new double[][]{ new double[]{1, 2, 3}, new double[]{4, 5, 6} }; MatrixChecker.verifyArrays(arrays); } | 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 length"); } } | 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 length"); } } } | 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 length"); } } } | 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 length"); } } } | 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 length"); } } } |
@Test public void testArray() { final double[] original = new double[]{ 1D, 2D, 3D, 4D, 5D, 6D }; final Matrix matrix = Matrix.array(original, 2); assertNotSame(original, matrix.getArray()); assertEquals(matrix.getRow(), 2); assertEquals(matrix.getCol(), 3); } | 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); } return Matrix.array(array, row); } | 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); } return Mat... | 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); } return Mat... | 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); } return Mat... | 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); } return Mat... |
@Test(expected = IllegalArgumentException.class) public void testArray2() { final double[] original = new double[]{ 1D, 2D, 3D, 4D, 5D, 6D }; Matrix.array(original, 4); } | 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); } return Matrix.array(array, row); } | 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); } return Mat... | 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); } return Mat... | 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); } return Mat... | 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); } return Mat... |
@Test public void testCopy() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 2); final Matrix b = a.copy(); assertNotSame(a, b); assertNotSame(a.getArray(), b.getArray()); assertEquals(b.getRow(), 2); assertEquals(b.getCol(), 3); assertArrayEquals(b.getArray(), new double[]{ 1, 2, 3, 4, 5, 6 }, 0); } | public Matrix copy() { final double[] array = mArray.clone(); return Matrix.array(array, mRow); } | Matrix implements Serializable { public Matrix copy() { final double[] array = mArray.clone(); return Matrix.array(array, mRow); } } | Matrix implements Serializable { public Matrix copy() { final double[] array = mArray.clone(); return Matrix.array(array, mRow); } private Matrix(double[] array, int row, int col); } | 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, int j); void set... | 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, int j); void set... |
@Test public void testZeros() { final Matrix matrix = Matrix.zeros(2, 3); assertEquals(matrix.getRow(), 2); assertEquals(matrix.getCol(), 3); assertArrayEquals(matrix.getArray(), new double[]{ 0D, 0D, 0D, 0D, 0D, 0D }, 0); } | public static Matrix zeros(@NonNull int... shape) { checkNotNull(shape); checkExpression( shape.length == 2, "Shape is incorrect"); return new Matrix(new double[shape[0] * shape[1]], shape[0], shape[1]); } | Matrix implements Serializable { public static Matrix zeros(@NonNull int... shape) { checkNotNull(shape); checkExpression( shape.length == 2, "Shape is incorrect"); return new Matrix(new double[shape[0] * shape[1]], shape[0], shape[1]); } } | Matrix implements Serializable { public static Matrix zeros(@NonNull int... shape) { checkNotNull(shape); checkExpression( shape.length == 2, "Shape is incorrect"); return new Matrix(new double[shape[0] * shape[1]], shape[0], shape[1]); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public static Matrix zeros(@NonNull int... shape) { checkNotNull(shape); checkExpression( shape.length == 2, "Shape is incorrect"); return new Matrix(new double[shape[0] * shape[1]], shape[0], shape[1]); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getAr... | Matrix implements Serializable { public static Matrix zeros(@NonNull int... shape) { checkNotNull(shape); checkExpression( shape.length == 2, "Shape is incorrect"); return new Matrix(new double[shape[0] * shape[1]], shape[0], shape[1]); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getAr... |
@Test public void testRandn() { final Matrix a = Matrix.randn(2, 3); assertEquals(a.getRow(), 2); assertEquals(a.getCol(), 3); } | public static Matrix randn(int row, int col) { checkDimensions(row, col); final Matrix matrix = Matrix.zeros(row, col); final double[] array = matrix.getArray(); final Random random = new Random(System.currentTimeMillis()); for (int i = 0, len = array.length; i < len; ++i) { array[i] = random.nextGaussian(); } return m... | Matrix implements Serializable { public static Matrix randn(int row, int col) { checkDimensions(row, col); final Matrix matrix = Matrix.zeros(row, col); final double[] array = matrix.getArray(); final Random random = new Random(System.currentTimeMillis()); for (int i = 0, len = array.length; i < len; ++i) { array[i] = ... | Matrix implements Serializable { public static Matrix randn(int row, int col) { checkDimensions(row, col); final Matrix matrix = Matrix.zeros(row, col); final double[] array = matrix.getArray(); final Random random = new Random(System.currentTimeMillis()); for (int i = 0, len = array.length; i < len; ++i) { array[i] = ... | Matrix implements Serializable { public static Matrix randn(int row, int col) { checkDimensions(row, col); final Matrix matrix = Matrix.zeros(row, col); final double[] array = matrix.getArray(); final Random random = new Random(System.currentTimeMillis()); for (int i = 0, len = array.length; i < len; ++i) { array[i] = ... | Matrix implements Serializable { public static Matrix randn(int row, int col) { checkDimensions(row, col); final Matrix matrix = Matrix.zeros(row, col); final double[] array = matrix.getArray(); final Random random = new Random(System.currentTimeMillis()); for (int i = 0, len = array.length; i < len; ++i) { array[i] = ... |
@Test public void testTranspose() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 2); final Matrix b = a.transpose(); assertEquals(b.getRow(), 3); assertEquals(b.getCol(), 2); assertArrayEquals(b.getArray(), new double[]{ 1, 4, 2, 5, 3, 6 }, 0); } | public Matrix transpose() { return Matrix.transpose(this); } | Matrix implements Serializable { public Matrix transpose() { return Matrix.transpose(this); } } | Matrix implements Serializable { public Matrix transpose() { return Matrix.transpose(this); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix transpose() { return Matrix.transpose(this); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double value); Matrix ... | Matrix implements Serializable { public Matrix transpose() { return Matrix.transpose(this); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double value); Matrix ... |
@Test public void testPlus() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix b = Matrix.array(new double[]{ 6, 5, 4, 3, 2, 1 }, 3); final Matrix c = a.plus(b); assertNotSame(c, a); assertEquals(c.getRow(), 3); assertEquals(c.getCol(), 2); assertArrayEquals(c.getArray(), new double[]{ ... | public Matrix plus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plus(this, matrix); } | Matrix implements Serializable { public Matrix plus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plus(this, matrix); } } | Matrix implements Serializable { public Matrix plus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plus(this, matrix); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix plus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plus(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); voi... | Matrix implements Serializable { public Matrix plus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plus(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); voi... |
@Test public void testPlusTo() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix b = Matrix.array(new double[]{ 6, 5, 4, 3, 2, 1 }, 3); final Matrix c = a.plusTo(b); assertSame(c, a); assertArrayEquals(a.getArray(), new double[]{ 7, 7, 7, 7, 7, 7 }, 0); } | public Matrix plusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plusTo(this, matrix); } | Matrix implements Serializable { public Matrix plusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plusTo(this, matrix); } } | Matrix implements Serializable { public Matrix plusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plusTo(this, matrix); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix plusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plusTo(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j);... | Matrix implements Serializable { public Matrix plusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.plusTo(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j);... |
@Test public void testMinus() { final Matrix a = Matrix.array(new double[]{ 6, 6, 6, 6, 6, 6 }, 2); final Matrix b = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 2); final Matrix c = a.minus(b); assertNotSame(a, c); assertEquals(c.getRow(), 2); assertEquals(c.getCol(), 3); assertArrayEquals(c.getArray(), new double[]... | public Matrix minus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minus(this, matrix); } | Matrix implements Serializable { public Matrix minus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minus(this, matrix); } } | Matrix implements Serializable { public Matrix minus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minus(this, matrix); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix minus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minus(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); v... | Matrix implements Serializable { public Matrix minus(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minus(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); v... |
@Test public void testMinusTo() { final Matrix a = Matrix.array(new double[]{ 6, 6, 6, 6, 6, 6 }, 2); final Matrix b = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 2); final Matrix c = a.minusTo(b); assertSame(c, a); assertArrayEquals(a.getArray(), new double[]{ 5, 4, 3, 2, 1, 0 }, 0); } | public Matrix minusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minusTo(this, matrix); } | Matrix implements Serializable { public Matrix minusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minusTo(this, matrix); } } | Matrix implements Serializable { public Matrix minusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minusTo(this, matrix); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix minusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minusTo(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j... | Matrix implements Serializable { public Matrix minusTo(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.minusTo(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j... |
@Test(expected = IllegalArgumentException.class) public void testVerifyArrays2() { MatrixChecker.verifyArrays(new double[0][0]); } | 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 length"); } } | 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 length"); } } } | 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 length"); } } } | 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 length"); } } } | 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 length"); } } } |
@Test public void testTimes() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix b = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix c = a.times(b); assertNotSame(c, a); assertEquals(c.getRow(), 3); assertEquals(c.getCol(), 2); assertArrayEquals(c.getArray(), new double[]... | public Matrix times(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.times(this, matrix); } | Matrix implements Serializable { public Matrix times(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.times(this, matrix); } } | Matrix implements Serializable { public Matrix times(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.times(this, matrix); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix times(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.times(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); v... | Matrix implements Serializable { public Matrix times(@NonNull Matrix matrix) { checkNotNull(matrix); return Matrix.times(this, matrix); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); v... |
@Test public void testTimesTo() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix b = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); final Matrix c = a.timesTo(b); assertSame(c, a); assertArrayEquals(a.getArray(), new double[]{ 1, 4, 9, 16, 25, 36 }, 0); } | public Matrix timesTo(double num) { return Matrix.timesTo(this, num); } | Matrix implements Serializable { public Matrix timesTo(double num) { return Matrix.timesTo(this, num); } } | Matrix implements Serializable { public Matrix timesTo(double num) { return Matrix.timesTo(this, num); } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public Matrix timesTo(double num) { return Matrix.timesTo(this, num); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double valu... | Matrix implements Serializable { public Matrix timesTo(double num) { return Matrix.timesTo(this, num); } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double valu... |
@Test public void testGet() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); assertEquals(a.get(2,1), 6, 0); } | public double get(int i, int j) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); return mArray[i * mCol + j]; } | Matrix implements Serializable { public double get(int i, int j) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); return mArray[i * mCol + j]; } } | Matrix implements Serializable { public double get(int i, int j) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); return mArray[i * mCol + j]; } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public double get(int i, int j) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); return mArray[i * mCol + j]; } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int g... | Matrix implements Serializable { public double get(int i, int j) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); return mArray[i * mCol + j]; } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int g... |
@Test public void testSet() { final Matrix a = Matrix.array(new double[]{ 1, 2, 3, 4, 5, 6 }, 3); a.set(1, 1, 666); assertEquals(a.get(1, 1), 666, 0); } | public void set(int i, int j, double value) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); mArray[i * mCol + j] = value; } | Matrix implements Serializable { public void set(int i, int j, double value) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); mArray[i * mCol + j] = value; } } | Matrix implements Serializable { public void set(int i, int j, double value) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); mArray[i * mCol + j] = value; } private Matrix(double[] array, int row, int col); } | Matrix implements Serializable { public void set(int i, int j, double value) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); mArray[i * mCol + j] = value; } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix ... | Matrix implements Serializable { public void set(int i, int j, double value) { checkExpression(i >= 0 && i < mRow && j >= 0 && j < mCol, "Row or col is out of bounds"); mArray[i * mCol + j] = value; } private Matrix(double[] array, int row, int col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.