the right way test date & time in java

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024

ความคิดเห็น • 92

  • @amigoscode
    @amigoscode  2 ปีที่แล้ว +5

    🚀 Thanks to Mailgun for sponsoring this video! Head to mailgun.com/amigoscode to try Mailgun today.
    🚀 Register your interested for bootcamp here: amigoscode.hopp.to/bootcamp-register-interest

    • @flyingrecordofficial
      @flyingrecordofficial 2 ปีที่แล้ว

      Great job bro

    • @ishyo9220
      @ishyo9220 2 ปีที่แล้ว

      East or west ⬅️
      Amigos code is the best 🤣

    • @flyingrecordofficial
      @flyingrecordofficial 2 ปีที่แล้ว +1

      @@ishyo9220why laughing 😅

    • @ishyo9220
      @ishyo9220 2 ปีที่แล้ว +1

      @@flyingrecordofficial
      that's smile for expressing my feelings on Amigos code...🤟
      I love it 😁

    • @MrUzair-bw3cg
      @MrUzair-bw3cg 2 ปีที่แล้ว

      Hello Sir!
      I am big fan of you.
      Can you build a Master course on spring boot with javafx.
      Because no one can explain briefly like you

  • @mrsofiane
    @mrsofiane 2 ปีที่แล้ว +16

    Yes it's always the best way to test time, i learned it in my internship

  • @erickjhormanromero6905
    @erickjhormanromero6905 2 ปีที่แล้ว +2

    Our Senior Java developer tought us to use LocaltTime.now() method to test but now i learned a new way of doing. i just need to undestand the reason and start using it.
    Thanks man

  • @abu-dukhan
    @abu-dukhan 2 ปีที่แล้ว +3

    Maasha Allah,
    Nelson, you really are natural.
    May Allah increase you in knowledge and reward you abundantly.
    And I personally cannot thank you enough, because you transformed my life as a Java back-end developer, once again, JazaakAllahu Khair

  • @franciscoruiz661
    @franciscoruiz661 2 ปีที่แล้ว +1

    In my opinion, the best and practice way is create an DateProvider interface. Then we will use DI for own services, and in the tests we use mocks for DateProvider interface. For DateProvider implementation we use LocalDateTime api

  • @dataslid
    @dataslid 2 ปีที่แล้ว

    Even when he said smash that like button only few people did, this is free golden contents and it costs nothing on your end.

  • @Denys.Stoianov
    @Denys.Stoianov 2 ปีที่แล้ว +2

    Thank you Mann, very interesting moment, I've seen it before in the code, but newer pay attention to this, now I know why smart devs use 'clock' together with local datetime. Very helpful. Please do more videos like this, together with the test example 😉

  • @soheilqalamkari2643
    @soheilqalamkari2643 4 หลายเดือนก่อน

    It was wonderful.Thanks a lot✌

  • @kelechidivine3350
    @kelechidivine3350 2 ปีที่แล้ว

    Nelson, I smashed the like button five times.

  • @sangmin7648
    @sangmin7648 2 ปีที่แล้ว +2

    I would also advise to use FixedClock implementation of Clock (which is a inner class of Clock) instead of mocking. Less mocking is always better, just call Clock.fixed()

  • @МарсельЮсупов-ф6ю
    @МарсельЮсупов-ф6ю 2 ปีที่แล้ว

    Thank you for your videos!!
    Could u make the video about where you need use the certain time class(LocaleDateTime, Instant, Date and etc) ?

  • @wallysonruan
    @wallysonruan ปีที่แล้ว

    Suggestion:
    Try to scroll the screen in a way that the code to be added or removed always stays near the center of the page, that will help people that uses the closed caption to be able to see the code while also reading the captions. When you edit a code that is too close to the bottom of the view-port we can't see it because the captions will be overlaying it.

  • @Jumataev
    @Jumataev ปีที่แล้ว

    great , thanks for showing how to organise

  • @joke4ey431
    @joke4ey431 2 ปีที่แล้ว

    really good content, i came across this problem today, but now I know how to solve this :D

  • @xixReact
    @xixReact 2 ปีที่แล้ว

    thanks mate for all your videos, they are very helpful! PS can u pls send some of the heat back to Aus

  • @dariofulci6549
    @dariofulci6549 2 ปีที่แล้ว

    Thank you for all course. Can't wait for new interesting one. I hope to see a course which replicate system design of twitter, uber, facebook... using java, kafka, rabbitmq ect. This one Microservices and Distributed Systems is amazing.

  • @sau2metat4nguoikhien72
    @sau2metat4nguoikhien72 2 ปีที่แล้ว +1

    i have a question : if a java web dev so i should use what idj eclipse vscode or more ?

  • @ehsansasanian9653
    @ehsansasanian9653 2 ปีที่แล้ว +2

    I guess you also need to configure Clock Bean in your app config. Otherwise you'd get NoSuchBeanDefinitionException

  • @mixelx
    @mixelx 2 ปีที่แล้ว

    Yeah, it's cool stuff, but you can also use MockedStatic to mock LocalDateTime

  • @vietronaldo23w
    @vietronaldo23w 2 ปีที่แล้ว

    great! it's helpful for me . thanks bro

  • @alameenalameen7191
    @alameenalameen7191 2 ปีที่แล้ว

    Iam watching your video right now it inspires me please make regular videos pls bro😟😟😟😟

  • @ЮрийАндрейцев-й1з
    @ЮрийАндрейцев-й1з 2 ปีที่แล้ว

    amazing video that teaches me to be better

  • @ИгорьСимаков-е5ж
    @ИгорьСимаков-е5ж 2 ปีที่แล้ว

    @Amigoscode
    What's the progress bar do you use?

  • @Mr.indian.justice.555
    @Mr.indian.justice.555 2 ปีที่แล้ว

    Hey @amigos , please try to make video on spring boot with antlr.
    Thanks ! 💕

  • @mxaix
    @mxaix 2 ปีที่แล้ว

    Hi…Salam, do you know if there are any online internship programs available where people can work voluntarily(unpaid)?

  • @Another0neTime
    @Another0neTime 2 ปีที่แล้ว

    Totally smahed that like button.

  • @terrah33
    @terrah33 2 ปีที่แล้ว

    Great video as usual! Would love some Go content as well :)

  • @helmigandi
    @helmigandi 2 ปีที่แล้ว +1

    I got error "required a bean of type 'java.time.Clock' that could not be found, Consider defining a bean of type 'java.time.Clock' in your configuration." when Inject ("private final Clock clock") in my service but I did not see Configuration Class in the video?

    • @karamelkhalfouni4015
      @karamelkhalfouni4015 2 ปีที่แล้ว +2

      I had the same problem. It seems like Spring expects a bean definition for the autowired Clock class. To solve that I added a class where I defined the bean. I looks like this : @Configuration
      public class ClockConfig {
      @Bean
      public Clock clock() {
      return Clock.systemDefaultZone();
      }
      }

  • @nametsegothakadu4702
    @nametsegothakadu4702 2 ปีที่แล้ว

    Can you make a video tutorial on how to setup maven(and the problems that come with not setting up pom.xml correctly) and missing springboot plugins properly using Intellij ?. I have been struggling with errors regarding my plugins and I have surfed so many blogs for solutions but I still can't make my ide properly work without these errors whenever i download my plugins for my projects. Please when u can I'd widely appreciate it

  • @svalyavasvalyava9867
    @svalyavasvalyava9867 2 ปีที่แล้ว

    Thank you so much!

  • @mahmudulislam5303
    @mahmudulislam5303 2 ปีที่แล้ว

    Great video as always

  • @rollingdice
    @rollingdice 2 ปีที่แล้ว

    thank u very much!!

  • @Vvay7
    @Vvay7 2 ปีที่แล้ว

    can you talking about atomicreference

  • @drakezen
    @drakezen 2 ปีที่แล้ว

    Where is the stackoverflow link to the Java data/time description?

  • @codertravel99
    @codertravel99 ปีที่แล้ว

    Hey hi Nelson it as awesome session thankyou to make a great session but can you please make a longer session on Date time because it is a complex concept thankyou again but if possible then please make a longer session specific on date time

  • @ahmadxrizvi
    @ahmadxrizvi 2 ปีที่แล้ว

    Assalamualaikum,
    Please try to make videos on Android development. I love your videos.

  • @erickjhormanromero6905
    @erickjhormanromero6905 2 ปีที่แล้ว

    Can i get the link of the java docs where this is mentioned?

  • @fahrican9708
    @fahrican9708 ปีที่แล้ว

    This explanation is amazing, I was doing LocalDateTime.now() always wrong

  • @didiwaytrooo
    @didiwaytrooo 2 ปีที่แล้ว

    i am your brother from Egypt , slamo alikom my brother . i am big fan fro you and interested very much in your great videos and tutorials .do you have a UDEMY channel for courses bro ?. i am beginner in the field with java . go on allah with you

  • @hendhasnaoui9419
    @hendhasnaoui9419 ปีที่แล้ว

    You rock ❤😊

  • @eugenesmith9940
    @eugenesmith9940 ปีที่แล้ว

    If token was expired at current date-time why it becomes valid if we add time?

  • @AaronEzekiel752
    @AaronEzekiel752 2 ปีที่แล้ว

    always watching you

  • @luizcalazans6415
    @luizcalazans6415 2 ปีที่แล้ว

    Awesome content

  • @scienc3tv
    @scienc3tv 2 ปีที่แล้ว

    We're missing your "A Salaaaamo Alaykom" in the intro...
    Great video tho, thank you bro.

  • @lenigaussgauss2428
    @lenigaussgauss2428 2 ปีที่แล้ว

    Funny at starting 🤣

  • @konstantindevelops131
    @konstantindevelops131 2 ปีที่แล้ว

    And were is the SO link for the time instances?

  • @ishyo9220
    @ishyo9220 2 ปีที่แล้ว +2

    Hello brother...🤟
    How I will be became like you...🤔
    I want to be like you man...😄
    From where I should start learning advance Java ... I had done my core Java ... Please guide me & others like me who are following you 💡 my brother help us... 😋

    • @francksgenlecroyant
      @francksgenlecroyant 2 ปีที่แล้ว +1

      Hey, search for the video which talks about roadmap made by Amigoscode, I'm sure it will help

  • @flyingrecordofficial
    @flyingrecordofficial 2 ปีที่แล้ว

    great job bro

  • @Kim-tr5op
    @Kim-tr5op 2 ปีที่แล้ว +2

    u should put like and subscribe section at the end of the video

    • @sykexz6793
      @sykexz6793 2 ปีที่แล้ว

      not everybody watches till the end

    • @Kim-tr5op
      @Kim-tr5op 2 ปีที่แล้ว

      @@sykexz6793 my comment is based on the human psyche :P If u make a good vid and people stay to the end, then u have a much higher chance for people to like and subscribe.

  • @yasinnabi
    @yasinnabi 2 ปีที่แล้ว

    This is a beautiful video... thumbs up ! subbed and liked .... a fellow creator.,

  • @KolomiecSergeyK
    @KolomiecSergeyK 2 ปีที่แล้ว +2

    Hello, could you please give link to stackoverflow

    • @amigoscode
      @amigoscode  2 ปีที่แล้ว +2

      stackoverflow.com/questions/32437550/whats-the-difference-between-instant-and-localdatetime

  • @adilwise
    @adilwise 2 ปีที่แล้ว

    Hi Nelson, you missed "to" in the title.

  • @billybob1620
    @billybob1620 8 หลายเดือนก่อน

    Or you can just use a date provider class which is arguably a lot more simple

  • @thekiterunner7082
    @thekiterunner7082 2 ปีที่แล้ว

    Good....

  • @hamza_Techy
    @hamza_Techy 2 ปีที่แล้ว

    Great!

  • @angelg3642
    @angelg3642 2 ปีที่แล้ว

    Great vid

  • @top10channels31
    @top10channels31 2 ปีที่แล้ว

    Hi guys i am working on a project accidentally I deleted my table and schema sequence table both now spring jpa not creating my table getting errors I have used ddl-auto=update
    Plz help me mysql8

  • @pepeclovis6247
    @pepeclovis6247 2 ปีที่แล้ว

    hello can i take some classes from you

  • @ahmedmk534
    @ahmedmk534 2 ปีที่แล้ว

    How do you show usages conters ?

    • @cdhagen
      @cdhagen 2 ปีที่แล้ว +1

      Newest IntelliJ version does this automatically. Search for „inlay hints“ in the preferences to turn on/off. I personally find it distracting and annoying. 😉

    • @ahmedmk534
      @ahmedmk534 2 ปีที่แล้ว

      @@cdhagen I have the latest version but still dont have them displayed. I think they are useful when working on bugs/tests and debuging :)

  • @Az1zdev
    @Az1zdev 2 ปีที่แล้ว +1

    Hello guys, who knows Amigos IDE theme name?

  • @precious8326
    @precious8326 2 ปีที่แล้ว

    the discord doesn't work ; (

  • @wilkyarny3012
    @wilkyarny3012 2 ปีที่แล้ว

    Hi there I smash the button 😂

  • @programmieraufgaben8391
    @programmieraufgaben8391 2 ปีที่แล้ว

    nice !

    • @user-gx8qs3ov1m
      @user-gx8qs3ov1m 2 ปีที่แล้ว

      Helpline📲📥⬆️
      Questions can come in⬆️

  • @assemkhaled3715
    @assemkhaled3715 2 ปีที่แล้ว +1

    how to destroy jwt token on logout in spring boot

  • @8d_songs
    @8d_songs 2 ปีที่แล้ว

    can you tell us about your religion background did you born as a muslim or you converted to islam

  • @Salihmanisali
    @Salihmanisali 2 ปีที่แล้ว

    Please could you provide the GitHub address

  • @himanshuu_21
    @himanshuu_21 2 ปีที่แล้ว +1

    1st view

  • @Coding.Practice
    @Coding.Practice 2 ปีที่แล้ว

    जय श्री राम।

  • @teddy6326
    @teddy6326 2 ปีที่แล้ว

    Can you teach slowly because sometimes you so fast .

  • @volodymyr.kushnir
    @volodymyr.kushnir 2 ปีที่แล้ว

    Why adding clock if there is simpler way:
    private final DateTimeService dateTimeService;
    usage: dateTimeService.now()
    public class DateTimeService {
    public Date now() { return new Date();} // make your own implementation
    }
    p.s. also it seems your code exposes too much data out of confirmation token -> encapsulation issue.

  • @franciscoripoll63
    @franciscoripoll63 2 ปีที่แล้ว +1

    excelent video. Your setUp method is not necessary, you just have to put the following annotation at the class level: "@ExtendWith(MockitoExtension.class)".

    • @erickjhormanromero6905
      @erickjhormanromero6905 2 ปีที่แล้ว

      he also needs to create a When call into the method

    • @franciscoripoll63
      @franciscoripoll63 2 ปีที่แล้ว

      ​@@erickjhormanromero6905 yes, then only mock with clock. OpenMocks line and constructor is not necessary over there