List of usage examples for java.util Calendar FEBRUARY
int FEBRUARY
To view the source code for java.util Calendar FEBRUARY.
Click Source Link
From source file:com.cemeterylistingswebtest.test.domain.RequiresApprovalDeceasedListingTest.java
@Test public void create() { System.out.println("Requires Approval Deceased Listing Test"); repoList = ctx.getBean(RequiresApprovalDeceasedListingRepository.class); subRepo = ctx.getBean(SubscriberRepository.class); userRepo = ctx.getBean(UserRoleRepository.class); //Initialise date Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2008); calendar.set(Calendar.MONTH, Calendar.FEBRUARY); calendar.set(Calendar.DATE, 4); java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime()); //Initialise user role UserRole userRole = new UserRole.Builder().setLevel(1).build(); //userRepo.save(userRole); //userRoleID = userRole.getUserRoleID(); //Initialise subscriber Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com") .setFirstName("Manfred").setSurname("Osulivan").setPwd("jesus").setUsername("ManiFredOssy") .setSubscriptionDate(javaSqlDate).setUserRoleID(userRole).build(); subRepo.save(newSub);//from w ww. ja v a2 s . c o m subID = newSub.getSubscriberID(); //Finally Initialise RequiresApprovalDeceasedListing RequiresApprovalDeceasedListing newListing = new RequiresApprovalDeceasedListing.Builder() .setFirstName("Hendrika").setSurname("Fourie").setMaidenName("Gerber").setGender("Female") .setDateOfBirth("08/06/1969").setDateOfDeath("14/02/2005") .setGraveInscription("Hippiest person eva").setGraveNumber("2456") .setImageOfBurialSite("/images/001.jpg").setLastKnownContactName("Berry") .setLastKnownContactNumber("0725576482").setSubscriberSubmitID(subID) //cemetery id //names .build(); repoList.save(newListing); id = newListing.getRequiresApprovalDeceasedListingID(); }
From source file:com.cemeterylistingswebtest.test.services.ViewListingByDateOfDeathServiceTest.java
@Test(enabled = true) public void TestDoD() { dateServ = ctx.getBean(ViewListingByDateOfDeathService.class); repoList = ctx.getBean(PublishedDeceasedListingRepository.class); subRepo = ctx.getBean(SubscriberRepository.class); userRepo = ctx.getBean(UserRoleRepository.class); //Initialise date Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2008); calendar.set(Calendar.MONTH, Calendar.FEBRUARY); calendar.set(Calendar.DATE, 4); java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime()); //Initialise user role UserRole userRole = new UserRole.Builder().setLevel(1).build(); //userRepo.save(userRole); //userRoleID = userRole.getUserRoleID(); //Initialise subscriber Subscriber newSub = new Subscriber.Builder().setEmail("manfredOsulivan@horseRaddish.com") .setFirstName("Manfred").setSurname("Osulivan").setPwd("jesus").setUsername("ManiFredOssy") .setSubscriptionDate(javaSqlDate).setUserRoleID(userRole).build(); subRepo.save(newSub);/*from w ww . ja v a 2s. co m*/ subID = newSub.getSubscriberID(); PublishedDeceasedListing newListing = new PublishedDeceasedListing.Builder().setFirstName("Hendrika") .setSurname("Fourie").setMaidenName("Gerber").setGender("Female").setDateOfBirth("08/06/1969") .setDateOfDeath("14/02/2005").setGraveInscription("Hippiest person eva").setGraveNumber("2456") .setImageOfBurialSite("/images/001.jpg").setLastKnownContactName("Berry") .setLastKnownContactNumber("0725576482") .setSubscriberSubmitID(subID).build(); repoList.save(newListing); List<PublishedDeceasedListing> pubListDod = dateServ.findListingByDOD("14/02/2005"); Assert.assertFalse(pubListDod.isEmpty()); repoList.delete(newListing); subRepo.delete(subID); }
From source file:org.jrimum.bopepo.TestFatorDeVencimento.java
@Test public final void testToFator() { data.set(2000, Calendar.JULY, 3); assertEquals(1000, FatorDeVencimento.toFator(data.getTime())); data.set(2000, Calendar.JULY, 5); assertEquals(1002, FatorDeVencimento.toFator(data.getTime())); data.set(2025, Calendar.FEBRUARY, 21); assertEquals(9999, FatorDeVencimento.toFator(data.getTime())); }
From source file:util.MyUtils.java
public static String getMonthString(int month) { switch (month - 1) { case Calendar.JANUARY: return "Jan"; case Calendar.FEBRUARY: return "Feb"; case Calendar.MARCH: return "Mar"; case Calendar.APRIL: return "Apr"; case Calendar.MAY: return "May"; case Calendar.JUNE: return "Jun"; case Calendar.JULY: return "Jul"; case Calendar.AUGUST: return "Aug"; case Calendar.SEPTEMBER: return "Sep"; case Calendar.OCTOBER: return "Oct"; case Calendar.NOVEMBER: return "Nov"; case Calendar.DECEMBER: return "Dec"; }/*www. j a v a2s .com*/ return ""; }
From source file:net.netheos.pcsapi.providers.hubic.SwiftTest.java
@Test public void testParseLastModified() { // Check we won't break if a header is missing : JSONObject json = new JSONObject(); Date timestamp = Swift.parseLastModified(json); assertNull(timestamp);//from ww w .j a v a 2 s . com json.put("last_modified", "2014-02-12T16:13:49.346540"); // this is UTC timestamp = Swift.parseLastModified(json); assertNotNull(timestamp); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.setTime(timestamp); assertEquals(2014, cal.get(Calendar.YEAR)); assertEquals(Calendar.FEBRUARY, cal.get(Calendar.MONTH)); assertEquals(12, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(16, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(13, cal.get(Calendar.MINUTE)); assertEquals(49, cal.get(Calendar.SECOND)); assertEquals(346, cal.get(Calendar.MILLISECOND)); checkLastModified("2014-02-12T16:13:49.346540", cal.getTime()); checkLastModified("2014-02-12T16:13:49.3460", cal.getTime()); checkLastModified("2014-02-12T16:13:49.346", cal.getTime()); cal.set(Calendar.MILLISECOND, 340); checkLastModified("2014-02-12T16:13:49.34", cal.getTime()); cal.set(Calendar.MILLISECOND, 300); checkLastModified("2014-02-12T16:13:49.3", cal.getTime()); cal.set(Calendar.MILLISECOND, 0); checkLastModified("2014-02-12T16:13:49.", cal.getTime()); checkLastModified("2014-02-12T16:13:49", cal.getTime()); }
From source file:com.cemeterylistingswebtest.test.domain.SubscriberTest.java
@Test(dependsOnMethods = "read") public void testDate() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2008); calendar.set(Calendar.MONTH, Calendar.FEBRUARY); calendar.set(Calendar.DATE, 4); java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime()); repo = ctx.getBean(SubscriberRepository.class); Calendar cal = Calendar.getInstance(); cal.setTime(javaSqlDate);//from w w w . j a va 2 s.co m int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); Assert.assertEquals(year, 2008); Assert.assertEquals(month, 01); //counts from 0 Assert.assertEquals(day, 4); }
From source file:org.jrimum.bopepo.TestFatorDeVencimento.java
@Test public final void testToDate() { data.set(2000, Calendar.JULY, 3); Date date = DateUtils.truncate(data.getTime(), Calendar.DATE); assertEquals(date, FatorDeVencimento.toDate(1000)); data.set(2000, Calendar.JULY, 5); date = DateUtils.truncate(data.getTime(), Calendar.DATE); assertEquals(date, FatorDeVencimento.toDate(1002)); data.set(2025, Calendar.FEBRUARY, 21); date = DateUtils.truncate(data.getTime(), Calendar.DATE); assertEquals(date, FatorDeVencimento.toDate(9999)); }
From source file:org.openmrs.module.radiology.hl7.message.RadiologyORMO01Test.java
@Before public void runBeforeEachTest() throws Exception { patient = new Patient(); patient.setPatientId(1);/*w w w . j a v a2s.c o m*/ PatientIdentifierType patientIdentifierType = new PatientIdentifierType(); patientIdentifierType.setPatientIdentifierTypeId(1); patientIdentifierType.setName("Test Identifier Type"); patientIdentifierType.setDescription("Test description"); PatientIdentifier patientIdentifier = new PatientIdentifier(); patientIdentifier.setIdentifierType(patientIdentifierType); patientIdentifier.setIdentifier("100"); patientIdentifier.setPreferred(true); Set<PatientIdentifier> patientIdentifiers = new HashSet<PatientIdentifier>(); patientIdentifiers.add(patientIdentifier); patient.addIdentifiers(patientIdentifiers); patient.setGender("M"); Set<PersonName> personNames = new HashSet<PersonName>(); PersonName personName = new PersonName(); personName.setFamilyName("Doe"); personName.setGivenName("John"); personName.setMiddleName("Francis"); personNames.add(personName); patient.setNames(personNames); Calendar calendar = Calendar.getInstance(); calendar.set(1950, Calendar.APRIL, 1, 0, 0, 0); patient.setBirthdate(calendar.getTime()); radiologyOrder = new RadiologyOrder(); radiologyOrder.setOrderId(20); Field orderNumber = Order.class.getDeclaredField("orderNumber"); orderNumber.setAccessible(true); orderNumber.set(radiologyOrder, "ORD-" + radiologyOrder.getOrderId()); radiologyOrder.setPatient(patient); calendar.set(2015, Calendar.FEBRUARY, 4, 14, 35, 0); radiologyOrder.setScheduledDate(calendar.getTime()); radiologyOrder.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); radiologyOrder.setInstructions("CT ABDOMEN PANCREAS WITH IV CONTRAST"); study = new Study(); study.setStudyId(1); study.setStudyInstanceUid("1.2.826.0.1.3680043.8.2186.1.1"); study.setModality(Modality.CT); radiologyOrder.setStudy(study); }
From source file:slina.mb.parsing.Parser3Tests.java
@Test public void sinParserTest() { Pattern p = Pattern.compile(ibmParserRegex); List<String> resultaArray = new ArrayList<String>(); for (String value : samples) { Matcher m = p.matcher(value); int count = m.groupCount(); assertTrue(count > 0);//from w w w. java 2 s. com boolean matched = m.matches(); assertTrue(matched); int year = Integer.parseInt(m.group(2)); if (year < 100) year = year + 2000; int month = Integer.parseInt(m.group(3)) - 1; int date = Integer.parseInt(m.group(4)); int hourOfDay = Integer.parseInt(m.group(5)); int minute = Integer.parseInt(m.group(6)); int second = Integer.parseInt(m.group(7)); int milSecs = Integer.parseInt(m.group(8)); Calendar cal = Calendar.getInstance(); cal.set(year, month, date, hourOfDay, minute, second); cal.set(Calendar.MILLISECOND, milSecs); Date mydate = cal.getTime(); assertNotNull(mydate); assertEquals(2011, cal.get(Calendar.YEAR)); assertEquals(Calendar.FEBRUARY, cal.get(Calendar.MONTH)); assertEquals(12, cal.get(Calendar.DAY_OF_MONTH)); String logLevel = m.group(13).trim(); assertTrue(logLevel.length() > 0); String className = m.group(12).trim(); assertTrue(className.length() > 0); String message = m.group(14).trim(); assertTrue(message.length() > 0); String logRecord = mydate + " - " + " - " + logLevel + " - " + className + " - " + message; System.out.println(logRecord); resultaArray.add(logRecord); } assertEquals(5, resultaArray.size()); }
From source file:org.spring.data.gemfire.cache.SpringGemfireTemplateTests.java
@Before public void setup() { assertNotNull("The '/Customers' Region was not properly configured and initialized!", customers); if (customers.isEmpty()) { assertEquals(0, customers.size()); put("Jon", "Doe", createDate(1959, Calendar.FEBRUARY, 14)); put("Jane", "Doe", createDate(1966, Calendar.APRIL, 4)); put("Fro", "Doe", createDate(2002, Calendar.DECEMBER, 16)); expectedCustomers = new ArrayList<>(3); expectedCustomers.add(put("Sour", "Doe", createDate(1983, Calendar.OCTOBER, 31))); expectedCustomers.add(put("Pie", "Doe", createDate(1988, Calendar.NOVEMBER, 22))); expectedCustomers.add(put("Cookie", "Doe", createDate(1991, Calendar.MAY, 27))); assertFalse(expectedCustomers.isEmpty()); assertEquals(3, expectedCustomers.size()); }/* w w w. ja v a2s.c o m*/ }