@Override public void handle(ChangesetInfo tea) { if(earliest == null || earliest.dateCreated.after(tea.dateCreated)) { earliest = tea; relayTo.handle(tea); foundMore = true; } } }
@Override public void handle(Note oldNote) { if(newNote.hasAssociatedElement()) { String firstCommentText = oldNote.comments.get(0).text; String newNoteRegex = getAssociatedElementRegex(newNote); if(firstCommentText.matches(newNoteRegex)) { super.handle(oldNote); } } } };
public String format(Date date) { return DEFAULT.format(date); } }
public void testShortForm() throws ParseException { Iso8601CompatibleDateFormat timezoneFormat = new Iso8601CompatibleDateFormat("Z"); Date x = timezoneFormat.parse("+0100"); Date y = timezoneFormat.parse("+01"); assertEquals(x,y); }
private Note findAlreadyExistingNoteWithSameAssociatedElement(final CreateNote newNote) { SingleElementHandler<Note> handler = new SingleElementHandler<Note>() { @Override public void handle(Note oldNote) { if(newNote.hasAssociatedElement()) { String firstCommentText = oldNote.comments.get(0).text; String newNoteRegex = getAssociatedElementRegex(newNote); if(firstCommentText.matches(newNoteRegex)) { super.handle(oldNote); } } } }; final int hideClosedNoteAfter = 7; osmDao.getAll(new BoundingBox( newNote.position.getLatitude(), newNote.position.getLongitude(), newNote.position.getLatitude(), newNote.position.getLongitude() ), handler, 10, hideClosedNoteAfter); return handler.get(); }
public void testSimple() throws IOException { String result = new TestXmlWriter() { @Override protected void write() throws IOException { begin("test"); end(); } }.test(); assertEquals(xmlBlob + "<test />", result); }
public void testText() throws IOException { String result = new TestXmlWriter() { @Override protected void write() throws IOException { begin("test"); text("jo <>"); end(); } }.test(); assertEquals(xmlBlob + "<test>jo <></test>", result); }
public void testAttribute() throws IOException { String result = new TestXmlWriter() { @Override protected void write() throws IOException { begin("test"); attribute("key", "value"); end(); } }.test(); assertEquals(xmlBlob + "<test key='value' />", result); }
public void testDoubleAttributeIsNotInScienfiticNotation() throws IOException { String result = new TestXmlWriter() { @Override protected void write() throws IOException { begin("test"); attribute("key", 0.0000001); end(); } }.test(); assertEquals(xmlBlob + "<test key='0.0000001' />", result); }
@Override protected void write() throws IOException { begin("test"); } }.test();
@Override protected void onStartElement() { checkDemAll(); }
public void testColon() throws ParseException { Iso8601CompatibleDateFormat timezoneFormat = new Iso8601CompatibleDateFormat("Z"); Date x = timezoneFormat.parse("+0300"); Date y = timezoneFormat.parse("+03:00"); assertEquals(x,y); }
@Override public void getAll(BoundingBox bounds, Handler<Note> handler, int limit, int hideClosedNoteAfter) { // ignoring all the parameters except the handler... for(Note note : notes) { handler.handle(note); } } }
public void testZulu() throws ParseException { Iso8601CompatibleDateFormat timezoneFormat = new Iso8601CompatibleDateFormat("Z"); Date x = timezoneFormat.parse("+0000"); Date y = timezoneFormat.parse("Z"); assertEquals(x,y); }
private void setUpThereIsANoteFor(CreateNote createNote, final Note note) { when(mapDataDao.getWay(createNote.elementId)).thenReturn(mock(Way.class)); doAnswer(invocation -> { Handler<Note> handler = (Handler<Note>) invocation.getArguments()[1]; handler.handle(note); return null; }).when(notesDao).getAll(any(), any(), anyInt(), anyInt()); }
public void testUTC() throws ParseException { Iso8601CompatibleDateFormat timezoneFormat = new Iso8601CompatibleDateFormat("Z"); Date x = timezoneFormat.parse("+0000"); Date y = timezoneFormat.parse("UTC"); assertEquals(x,y); } }
public void testColonWithMinutes() throws ParseException { Iso8601CompatibleDateFormat timezoneFormat = new Iso8601CompatibleDateFormat("Z"); Date x = timezoneFormat.parse("+0130"); Date y = timezoneFormat.parse("+01:30"); assertEquals(x,y); }