CRUD JUnit Tests for Spring Data JPA | Testing Repository Layer | Spring Boot | @DataJpaTest

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024

Комментарии • 74

  • @sanketlondhe7725
    @sanketlondhe7725 2 года назад +2

    i have watched your several videos on react integration with spring boot for crud operation and now this video, you are awesome , you deserve 10 x subscriber than this

  • @AshishRohillax
    @AshishRohillax 2 года назад +6

    Good video. Instead of using a Test method to save data in db to use in other test methods, you could use a sql file to load data in in-memory db.

  • @aadiraj6126
    @aadiraj6126 3 года назад +7

    Hey Ramesh bro, can u make a long, fat...Complete junit + mockito videos, with covering major real time scenarios. You've quite smooth flow of teaching.

  • @ivanpassalia8244
    @ivanpassalia8244 2 года назад +2

    Thanks! this video help me a lot to complete my first testing unit, i cant found a way to create a testing database to check my CRUD and routes! and you answered all at the same time!!!

  • @privateuser047
    @privateuser047 3 года назад +2

    Awesome video.
    Explanation is on another level.
    Somehow, I end up here for solution.
    Thanks. Java Guides 🙂

  • @nagvraj7859
    @nagvraj7859 3 года назад +9

    Bro Make one video on junit and mockito using all the annotations like real time.

  • @SuyashChahande-g7p
    @SuyashChahande-g7p Год назад +1

    Thank you @javaGuides

  • @mahammadrafimulla9093
    @mahammadrafimulla9093 2 года назад +1

    Nice explanation

  • @java_lover
    @java_lover 2 года назад

    Very good teaching tq

  • @meenajadhav5533
    @meenajadhav5533 3 года назад +1

    Very simple tutorial with line by line coding 👌

  • @evgeniyosis613
    @evgeniyosis613 3 года назад +2

    Please, make video series where you testing all layers in a simple crud application

  • @shubhamdalvi7550
    @shubhamdalvi7550 2 года назад

    Awesome video clear all the concepts 👍

  • @Shiva_Codes
    @Shiva_Codes 3 года назад +1

    @JavaGuides Please make more videos on these JUnit Testing with different kinds of apps not just CRUD based apps

  • @goofyTavern
    @goofyTavern 3 года назад

    WoW! Really cool 😎

  • @javatechnology4481
    @javatechnology4481 3 года назад

    Excellent video

  • @vndprasadgrandhi7024
    @vndprasadgrandhi7024 3 года назад +2

    Hi Bro, Firstly thank you very much for creating wonderful video. If we need test service layer with Junit. How we will do. If possible do the video on this concept plz. Its very useful for everyone.

    • @praveenl1800
      @praveenl1800 3 года назад

      yes I am also looking for the same.. please make a video on testing service layer class

  • @shashankvishwakarma959
    @shashankvishwakarma959 2 года назад

    great work !

  • @tw5529
    @tw5529 3 года назад

    Awesome 👍👍

  • @sarfarazraj2865
    @sarfarazraj2865 2 года назад

    Your Videos are very good please do something for the low sound, I can't hear you clearly.

  • @parthdeveloper2793
    @parthdeveloper2793 3 года назад +1

    Good tutorial ❤️🙌
    Can you please make a video on junit testing for DynamoDb with controller and service layer code.

  • @gokulaher2476
    @gokulaher2476 2 года назад +4

    Hi Ramesh, Do you have any video on how to use the real database like Oracle, MySQL, PostgresSQL etc
    for running test cases instead of using the in-memory database and also can we see the records/transaction(without rollback) in the database tables created by test cases? what configuration is required to do the same ?

    • @francksgenlecroyant
      @francksgenlecroyant Год назад +1

      In that case you should create a configuration file, a regular properties or yml file under src/test/resources/ and spring is smart enough to detect that when you run your tests, you can configure your desired database in that file. But it's not recommended. Instead, you should make sure you use the in-memory database in your test cases to avoid hitting the real database.

  • @nagaraju-ll1gk
    @nagaraju-ll1gk 3 года назад

    Super teaching

  • @vndprasadgrandhi7024
    @vndprasadgrandhi7024 3 года назад

    Great video bro.. Thanks

  • @pranavmahajan4190
    @pranavmahajan4190 3 года назад +1

    I have a request, can you please cover EntityManager testing with Mockito?

  • @mathewsxavier1523
    @mathewsxavier1523 2 года назад

    bro what is the point of testing the inbuilt jpa methods? if there is any custom method you wrote inside repo that can be tested. all these save, find are tested by the spring team.

  • @vishalr1140
    @vishalr1140 2 года назад

    Hi, I added lombok dependency. But .builder is not working in employeeRepositoryTests. How to solve ?

  • @kulkarniprabhakar290
    @kulkarniprabhakar290 7 месяцев назад

    Guys in case you are unable to use builder patters and it says "The method builder() is undefined for the type Employee" please make sure you have the project lombok configured in your working IDE.

  • @UpThrustt
    @UpThrustt 9 месяцев назад

    Not able to call the lambkok bulder() method in test method

  • @Shiva_Codes
    @Shiva_Codes 3 года назад

    @JavaGuides Please add TimeStamps of Sub-Topics in this video in description

  • @Gaurav-wy2wm
    @Gaurav-wy2wm 3 года назад

    Sir please tell difference between @Bean and @Autowired

  • @revathiruby8541
    @revathiruby8541 10 месяцев назад

    Npe while accessing the repository

  • @harifactsandupdates
    @harifactsandupdates 2 года назад

    Hii while using lambok it's asking license can u help??

  • @DeepakGupta-hj2dv
    @DeepakGupta-hj2dv 3 года назад +1

    Sir please make on video spring boot unit testing crash course

    • @DeepakGupta-hj2dv
      @DeepakGupta-hj2dv 3 года назад

      please make on video spring boot microservices tutorial

  • @rijav
    @rijav 2 года назад

    hi, i already have an employee management system app created with springboot and configured with mysql, but these tests aren't running, throwing errors such as "table not found" and "could not prepare statement". I'm using constructor in the save employee method (not Builder). can someone please help me?

    • @tresornaruffygo1816
      @tresornaruffygo1816 2 года назад

      those test are meant to use an enbedded h2 database, for mysql you have to disable autoconfiguration for @DataJpaTest

  • @ken42923
    @ken42923 3 года назад

    Hi bro your videos are awesome could you please make relationship like one to one many to one thise working with spring data jpa

    • @JavaGuides
      @JavaGuides  3 года назад

      These videos are already available on this channel

  • @sharvaridesai4580
    @sharvaridesai4580 2 года назад

    I have used @DataJpaTest annotation but it's giving error as "failed to load application context error". Please help

    • @alpt1980
      @alpt1980 Год назад

      how u solved this ,i cant solve . so annoying

  • @beastbaby7946
    @beastbaby7946 2 года назад

    failed to load application context error pls fix

  • @Annamfashion
    @Annamfashion 3 года назад

    Why use lombok dependency
    Instead of which one used

    • @JavaGuides
      @JavaGuides  3 года назад

      If you don't want to use lombok then remove lombok dependency from pom. xml and add getters/setters methods in JPA entity.

  • @mayurimule8188
    @mayurimule8188 2 года назад +1

    assertThat is not working, how to fix it

    • @JavaGuides
      @JavaGuides  2 года назад

      You need to import Assertions class from assertJ library. Example:
      import org.assertj.core.api.Assertions;

    • @mayurimule8188
      @mayurimule8188 2 года назад

      @@JavaGuides yeah did that, but its not working

  • @harifactsandupdates
    @harifactsandupdates 2 года назад

    While using Lombok getting license error what to do???

    • @JavaGuides
      @JavaGuides  2 года назад

      What is the error? Can you paste here

    • @harifactsandupdates
      @harifactsandupdates 2 года назад

      @@JavaGuides copyright 2022 the original author or authors,licensed under Apache,version 2.0(you may not use this file except in compliance with.
      You may obtain a copy of the license at.....link given

    • @harifactsandupdates
      @harifactsandupdates 2 года назад

      @@JavaGuides it's showing builder() is undefined for the type employee

    • @JavaGuides
      @JavaGuides  2 года назад

      @@harifactsandupdates which IDE you are using?

    • @JavaGuides
      @JavaGuides  2 года назад

      If you are using IntelliJ IDEA then restart it. If you are using Eclipse STS then you need to install Lombok first.

  • @harshpalsingh1145
    @harshpalsingh1145 2 года назад

    Instead of using DB, you should have just used Mock to fake the DB operations.

  • @sanketlondhe7725
    @sanketlondhe7725 2 года назад

    builder() is not working

    • @JavaGuides
      @JavaGuides  2 года назад

      install Lombok library in your IDE

    • @JavaGuides
      @JavaGuides  2 года назад

      If you are using IntelliJ then restart again will work

    • @sanketlondhe7725
      @sanketlondhe7725 2 года назад

      I am using sts and i have added dependency

    • @sanketlondhe7725
      @sanketlondhe7725 2 года назад

      Annotation is able to import but builder() method is not working

    • @JavaGuides
      @JavaGuides  2 года назад

      @@sanketlondhe7725 install lombok in STS. refer my video at ruclips.net/video/VR7VaiXHJEY/видео.html

  • @techakash7026
    @techakash7026 2 года назад

    sir builder() method not working in my system I followed you step by step in this video

    • @JavaGuides
      @JavaGuides  2 года назад

      Install Lombok library in your STS IDE

    • @techakash7026
      @techakash7026 2 года назад

      @@JavaGuides thank you I fix It

  • @tresornaruffygo1816
    @tresornaruffygo1816 2 года назад

    those aren't unit tests

  • @abelteshome9429
    @abelteshome9429 2 года назад +1

    if you're facing an error related to @DatajpaTest annotation you have to add this @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) annotation

  • @livecoding21
    @livecoding21 Год назад +1

    Failed to instantiate [org.springframework.data.jpa.repository.JpaRepository]: Specified class is an interface

  • @dusmannalinwad
    @dusmannalinwad 2 года назад

    please publish the code via GitHub.!