<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gabi</title>
    <description>The latest articles on DEV Community by Gabi (@gabriela).</description>
    <link>https://dev.to/gabriela</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F126657%2F93802ca8-aea0-47f8-8aa3-0b49bde29410.png</url>
      <title>DEV Community: Gabi</title>
      <link>https://dev.to/gabriela</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabriela"/>
    <language>en</language>
    <item>
      <title>Own your code!</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Thu, 22 Apr 2021 13:43:17 +0000</pubDate>
      <link>https://dev.to/gabriela/own-your-code-2kgf</link>
      <guid>https://dev.to/gabriela/own-your-code-2kgf</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;It all started with this simple post on LinkedIn: &lt;a href="https://www.linkedin.com/posts/activity-6788719786659524608-Gww8"&gt;https://www.linkedin.com/posts/activity-6788719786659524608-Gww8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Own your code! ✔️&lt;br&gt;
Say what? 🔥&lt;/p&gt;

&lt;p&gt;If you are in the middle of interviewing or have been recently and you gave your best and worked extra, and your work wasn't paid, then think about re-using that initial effort and make it public for others to see. If you didn't sign an NDA, didn't get paid for that take-home project, well... firstly, I know the frustration, and secondly, the code is yours. Be blond, share it out and loud for future you and other companies. I don't care if you started coding last month or 20 years ago; share your work. Don't let the take-home tests be forgotten somewhere. A lot of them are quite similar, so maybe next time you can leverage that and say "Hey, I already did one similar, take a look at that, please".&lt;/p&gt;

&lt;p&gt;Let's share our take-home projects. &lt;br&gt;
These are my latest (didn't keep old ones): &lt;a href="https://tinyurl.com/kx7b3p5w"&gt;https://tinyurl.com/kx7b3p5w&lt;/a&gt; &lt;br&gt;
Looking forward to seeing your projects in the comments.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>career</category>
      <category>hiring</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Nevertheless, Gabi Coded in 2021 also!</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Wed, 03 Mar 2021 17:29:34 +0000</pubDate>
      <link>https://dev.to/gabriela/nevertheless-gabi-coded-in-2021-also-3f7h</link>
      <guid>https://dev.to/gabriela/nevertheless-gabi-coded-in-2021-also-3f7h</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvz6t1tiav8itvitf2ipk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvz6t1tiav8itvitf2ipk.png" alt="Alt Text" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
Thanks to @Dell for making this photo available freely &lt;a href="https://unsplash.com/photos/g2E2NQ5SWSU"&gt;https://unsplash.com/photos/g2E2NQ5SWSU&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advocating for myself
&lt;/h2&gt;

&lt;p&gt;Advocating for myself seems to be like a non-stop task which I learned to not give a damn about when it becomes too much. I realised that giving my time like this is taxing and non-productive for me. I am just at the beginning of my career (13+ years) and I have a long long way until retirement. Understanding this puts things in perspective. Current juniors will be the next seniors, not everyone is the same, good people will form good people, technologies will change, projects and companies will change and so on. I am sure my mom and dad's resume wouldn't fit on the 1 or 2 pages of CV if they were to describe THE MAIN THINKS that they worked on during their long career. I still giggle a bit when I hear some CV advice (well-intended even so). It's like we forget this software development domain is at it's beginning still, and we forget we have a few more decades of work until retirement.&lt;/p&gt;

&lt;h2&gt;
  
  
  My biggest goal
&lt;/h2&gt;

&lt;p&gt;My biggest goal is the sum of a lot of small goals. Always has been and always will be if you ask me now. I want to leave doors open to change my mind, change interests and change paths in my career. This abstract is what works well for now and leaves room for a lot of improvement. I have learned and evolved in my craft so much since I started writing code and I will continue to learn and adapt as long as I can do my job. I studied and worked hard to be a Software Developer because I want to create stuff, useful stuff and as many as possible. The point is to help myself and others with technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  My advice for allies
&lt;/h2&gt;

&lt;p&gt;My advice for allies to support underrepresented folks who code is exactly what you read in memes, Twitter feeds, blog posts: believe us when we present something that is wrong. Just freaking believe us like you would your white-male colleague that you go for beers with every week. Of course, there will be people that will try to cheat this, take advantage of this, but &lt;em&gt;we&lt;/em&gt;- as a group are not them, the exact same way &lt;em&gt;you&lt;/em&gt; as a group are inclusive, helpful and decent humans. I had to make these analogies, but we should already see ourselves as one group, not separate.&lt;/p&gt;

&lt;p&gt;What about you?&lt;/p&gt;

</description>
      <category>wecoded</category>
    </item>
    <item>
      <title>Motion animations with an SVG</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Thu, 14 Jan 2021 19:48:30 +0000</pubDate>
      <link>https://dev.to/gabriela/motion-animations-with-an-svg-53mc</link>
      <guid>https://dev.to/gabriela/motion-animations-with-an-svg-53mc</guid>
      <description>&lt;p&gt;I personally think of CSS animations as something complex. While this is still true, I am making steps towards learning more about it, because that's the only way to fill knowledge gaps. I am going to teach you how to animate an SVG, using Figma and CSS. We are going to use Figma because it's so useful to ~see~ and ~group~ the elements that you will later want to animate. For the next steps, I will just assume you have a Figma account and a small project you can tinker with.&lt;/p&gt;

&lt;p&gt;Our demo SVG is one from &lt;a href="https://undraw.co/" rel="noopener noreferrer"&gt;https://undraw.co/&lt;/a&gt; (search for &lt;code&gt;reading&lt;/code&gt;) and after some minor modifications, I used it on the front page of my digital garden &lt;a href="https://gabriela.codes" rel="noopener noreferrer"&gt;https://gabriela.codes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Open an SVG&lt;/h2&gt;

&lt;p&gt;Choose your image in SVG format and open it in Figma&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj2cxnsxnb65fm3h4aefd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj2cxnsxnb65fm3h4aefd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the left side, you will see all the individual ids for all the constructed elements. You can hide them, group them, delete them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fblsu5xpddo1p47xpqwry.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fblsu5xpddo1p47xpqwry.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Group what you want to animate&lt;/h2&gt;

&lt;p&gt;We are going to select the character's left leg and group it into one element. Click on one part of the leg, hold &lt;code&gt;SHIFT&lt;/code&gt; down and continue clicking on the rest of the items. You will get to a situation similar to this. After that &lt;code&gt;CTRL+G&lt;/code&gt; and it will group it. Rename the default name to something that is representative of what you selected, for example: &lt;code&gt;leftleg&lt;/code&gt;. Do the same to anything else you think it will be nice to animate, like the clouds, flowers, hands.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffx74lxuuhfow9j92prr9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffx74lxuuhfow9j92prr9.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you are done grouping, it's time to export the .svg file &lt;code&gt;with the id attributes&lt;/code&gt; like in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe525a32fy2la4w7nz312.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe525a32fy2la4w7nz312.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Back to code&lt;/h2&gt;

&lt;p&gt;The first important part is completed and now we just need to write some CSS to animate our image.&lt;/p&gt;

&lt;p&gt;We place our SVG inside a container:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div class="svg-animation-container"&amp;gt;..&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;And we start adding animations for each group that we are interested into.&lt;/p&gt;

&lt;h3&gt;Right Leg&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#rightleg {
  animation: rotateHand 5s alternate;
  transform-origin: top left;
  transform-box: fill-box;
  animation-duration: 16s;
}

@keyframes rotateHand {
  0% {
    transform: rotate(-5deg);
  }

  50% {
    transform: rotate(5deg);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use CSS rotate() function to rotate in the opposite direction using a negative degree value &lt;code&gt;-5deg&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Both hands&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#bothhands {
  animation: rotateLHand 2s alternate;
  transform-origin: top left;
  transform-box: fill-box;
  animation-delay: 1.25s;
}

@keyframes rotateLHand {
  0% {
    transform: rotate(5deg);
  }

  50% {
    transform: rotate(0deg);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;Clouds going up&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#clouds {
  animation: rotateLHand 2s alternate;
  animation-duration: 16s;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can continue to add motion to other ids that you have in your SVG and just play around to see what goes good together. Don’t forget, some people can get motion sickness from too many animations on the screen. Trust me. :)&lt;/p&gt;

</description>
      <category>animations</category>
      <category>css</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Lessons from a failed idea</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Wed, 11 Nov 2020 08:21:26 +0000</pubDate>
      <link>https://dev.to/gabriela/lessons-from-a-failed-idea-258l</link>
      <guid>https://dev.to/gabriela/lessons-from-a-failed-idea-258l</guid>
      <description>&lt;p&gt;I am a software developer that has a couple of small notebooks around the house where I write most of my ideas and thoughts about new projects I would like to create. Here’s the story of how I decided to build an idea without thinking about all the needed UX/UI/design system skills and when that turned out to be a problem.&lt;/p&gt;

&lt;p&gt;This story would be way more glamorous if I talked about a simple idea that popped into my mind on a casual day and made it into a resounding success. I know this type of stories, I read them as well. This post is not about that, because I haven’t experienced it yet. We rarely read about failing projects, because some might not consider it to be valuable. Well, for me it is. Representation is always valuable.&lt;/p&gt;

&lt;p&gt;I have worked on products that were a success but they weren’t my projects. And more importantly, I don’t know how many years of failing it took for that idea to succeed.&lt;/p&gt;

&lt;p&gt;The first idea that left the cosiness of my computer and version control, is “Plan Our Wedding”. You guessed it, it’s a wedding management web app. I wanted to use one tool that can help myself and my partner manage everything about our (not exactly) small wedding that was coming up. I wanted to have privacy (arghhh!!!!) and to communicate mostly online with our guests before the event.&lt;/p&gt;

&lt;p&gt;Our planet has enough problems so I didn’t feel the need to bring paper invites into it. I know they wouldn’t get recycled by everyone. In full disclosure, we still made some, specifically for a different generation that doesn’t want to use technology for this type of event.&lt;/p&gt;

&lt;p&gt;This is the first project I dedicated an entire year to. I learned so much throughout the whole process and I know I wouldn’t have had the opportunity if I was working a 9-5 job.&lt;/p&gt;

&lt;p&gt;For me, it’s not important just to create stuff, but to learn as well. I wanted to be better, so I decided to work full-stack for this. On frontend I chose Html/CSS, JavaScript with React.Js. On backend, I stuck with what I knew already, Java and SpringBoot, so I get some wins whilst I am learning something new. It’s important to have some wins as well, keeps you motivated when you want to quit and go back to “comfort”.&lt;/p&gt;

&lt;p&gt;My game plan looked like this:&lt;/p&gt;

&lt;p&gt;I already had the idea. It’s a wedding management tool. I was the first client, so it was fixing my own problems.&lt;br&gt;
Document what technologies to use on the frontend side. a. Why did I choose React.js? It wasn’t a personal preference, I chose what was popular on the European Job market at that time. b. Why Java 11 on backend? Because I have worked mostly with Java, either on backend or native Android. I was comfortable with it. SpringBoot was a clear choice because from 0 to production it takes a short amount of time.&lt;br&gt;
Naively created some milestones to get a sense of what timeline I was looking forward to. On backend side, that was easier, on frontend, it was not.&lt;br&gt;
Draw in a minimal way what I would like each screen to look like.&lt;br&gt;
Create a structure for the backend side. I wanted to write and run tests: unit tests and integration tests. For this, I made different profiles so I don’t mess up my production database. I wanted to manage my database properly, be comfortable deleting it and getting the structure AND demo data back in 1 minute.&lt;br&gt;
The initial plan was based on everything I thought I knew about creating a project. It was intentional and actionable, I knew what I was working on each week. I didn’t count my hours specifically, but I didn’t work too much over the usual hours. One big difference was that I was way more concentrated and less distracted by meetings or random chitchatting in an open office structure. I was changing hats often, I was either the developer or the project owner. It was important to do this because I wanted a product that helps with self-managing a wedding and I didn’t want to stray away from that just to try some cool technical feature that wasn’t helping.&lt;/p&gt;

&lt;p&gt;As time passed by, my features were implemented and the dashboard started to take shape. I didn’t get back to modify my plan, because a lot of times I redid some parts, rewrote some code. It was either because what I knew was outdated and a better way to do it was already available, or because I didn’t see the feature in the same way. First reality check with multiple users was when we sent the RSVP invites to friends and colleagues.&lt;/p&gt;

&lt;p&gt;It’s something very real and raw when another person uses your application. All the «this isn’t important, I’ll fix that another time » moments became « this IS important, it doesn’t work for the users». They don’t know the intricates of that, and why should they? If you send them a form to complete, they want to complete that form.&lt;/p&gt;

&lt;p&gt;I used a free tier on what services I could because I didn’t have money to spend on this. In reality, I did, because I had enough to pay myself a base salary, but I didn’t think of it to be important at that time. On design …oh… I changed the ‘design’ at least 3 times. What I didn’t recognise is that I needed to study UX/UI and practice a lot before I can create a design system on my own. For this, I definitely didn’t have enough money, even if I wanted to.&lt;/p&gt;

&lt;p&gt;The first user that wasn’t us or our invitees, was a friend that had a wedding that same year. They didn’t have time to do much on the platform, and realistically I can understand why. The web app worked for me because I created it, but for others, it wasn’t user friendly.&lt;/p&gt;

&lt;p&gt;I can recognise that at this moment I should have reset a bit and think of my actionable plan of increasing the quality and user experience. And I should have done user research. A fancy way of saying that I should have talked to my one and only user about how they use the app. I could have worked more ‘in public’ and write about my journey. Instead, I wallowed that I failed and took a few weeks away from the project. On top of that, I started a small new project just so I get a positive mindset that I can still create something. In hindsight, I shouldn’t have done that. After some time, I regained my enthusiasm and I was ready again to continue my work.&lt;/p&gt;

&lt;p&gt;That year of learning and creating something from scratch is on the list of best investments in my career. Every time you can learn something new or, and this is equally important, you get the chance to re-learn something you think you knew, take it. Do the work. Invest in your own career and don’t expect others to do it for you.&lt;/p&gt;

&lt;p&gt;I learned how important UX and UI is for a product. If your product is not easy to use, then you need to fix that. If you are lacking some skills (realistically there must be at least something that is not in your strong skill set), and you can afford this, delegate to other professionals to help you out in your journey. Because from I can tell, it’s a journey and it can be a long one. Read as much as you can about every question that pops into your head about project management, web accessibility, project architecture, testing, user research etc.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed reading about my lessons. If you want to follow along my journey, check out my website where I like to write more about technical topics and ideas: gabriela.codes.&lt;/p&gt;

&lt;p&gt;Do you have a failing idea story to share with us?&lt;/p&gt;

</description>
      <category>startup</category>
      <category>design</category>
      <category>ideas</category>
      <category>failing</category>
    </item>
    <item>
      <title>🚨How did you start your business?🚨</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Mon, 28 Sep 2020 12:45:33 +0000</pubDate>
      <link>https://dev.to/gabriela/how-did-you-start-your-business-2fk8</link>
      <guid>https://dev.to/gabriela/how-did-you-start-your-business-2fk8</guid>
      <description>&lt;p&gt;🚨How did you start your business?🚨&lt;/p&gt;

&lt;p&gt;Did you do it in parallel with another job?&lt;br&gt;
Did you have EU funding, personal funding?&lt;br&gt;
Were you profitable from the start?&lt;/p&gt;

&lt;p&gt;✍️Looking to create a thread of insights from people that tried to build something.&lt;/p&gt;

&lt;p&gt;Thank you so much for sharing.&lt;/p&gt;

</description>
      <category>startup</category>
      <category>watercooler</category>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>Trying out Criteria Builder in a Java project</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Wed, 09 Sep 2020 11:01:49 +0000</pubDate>
      <link>https://dev.to/gabriela/how-to-use-criteria-builder-in-your-java-project-4ag0</link>
      <guid>https://dev.to/gabriela/how-to-use-criteria-builder-in-your-java-project-4ag0</guid>
      <description>&lt;p&gt;Initially published on my blog: &lt;a href="https://documentingiscool.netlify.app/blog/2020/08/how-to-use-criteria-builder-in-your-java-project/"&gt;https://documentingiscool.netlify.app/blog/2020/08/how-to-use-criteria-builder-in-your-java-project/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Java, SpringBoot
&lt;/h1&gt;

&lt;p&gt;If you are writing a REST API in Java and SpringBoot for your side projects or at work, I am guessing you have used JPA by now. You probably heard of CriteriaBuilder, but if not, don't worry. I personally have only heard of it a couple of years ago. Looking online on the timeline of this, it appears to be available since Java Persistence 2.0 (&lt;a href="https://tinyurl.com/y2f4srv5"&gt;Source&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;So it's about time I learn the power of writing complex queries in a way that, for example, in a refactoring situation I don't need to change strings in my queries. This is part one of using Criteria Builder (package &lt;code&gt;javax.persistence&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;How I used to write queries (long time ago). Do not do this now. It's 2020:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String query = "Select usr.username from PlatformUser usr where usr.companyId = " + companyId;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How I am writing queries using positional parameters in queries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Repository
public interface PlatformUserRepository extends JpaRepository&amp;lt;PlatformUser, Long&amp;gt; {
@Query("SELECT item FROM PlatformUser usr where usr.companyId = ?1")
    List&amp;lt;String&amp;gt; findAllCompanyUsernames (Long companyId);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What I could do with Criteria Builder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery&amp;lt;String&amp;gt; criteriaQuery = criteriaBuilder.createQuery(String.class);
Root&amp;lt;PlatformUser&amp;gt; root = criteriaQuery.from(PlatformUser.class);
criteriaQuery.select(root);
Query query = entityManager.createQuery(criteriaQuery);
List&amp;lt;String&amp;gt; results = query.getResultList();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to have access to the entity manager your need to inject it in your repository class.&lt;br&gt;
&lt;code&gt;@PersistenceContext&lt;br&gt;
    private EntityManager entityManager;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Documentation for Criteria Builder is lacking from my point of view, so I am trying my best to explain line by line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example from the demo project:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Using Lombok plugin for getters and setters
@Getter
@Setter
public class CompanyHandyPersonDto {

    private Long id;
    private String fullName;
    private Long companyId;
    private Long tradeId;
    private String comment;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple select from a table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Repository
public class CompanyHandyPersonRepository implements CompanyHandyPersonRepositoryInterface {

    @PersistenceContext
    private EntityManager entityManager;

    @Override
    public List&amp;lt;CompanyHandyPerson&amp;gt; findAllHandyPersons() {
        // Get instance of criteria builder from an entity manager
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();

        // Create a query object
        CriteriaQuery&amp;lt;CompanyHandyPerson&amp;gt; criteriaQuery = criteriaBuilder.createQuery(CompanyHandyPerson.class);

        // Root of this query (I have no better idea of how to explain this)
        Root&amp;lt;CompanyHandyPerson&amp;gt; root = criteriaQuery.from(CompanyHandyPerson.class);

        // Choosing what data the query returns
        criteriaQuery.select(root);

        Query query = entityManager.createQuery(criteriaQuery);

        // Run the query constructed above and extract the result
        List&amp;lt;CompanyHandyPerson&amp;gt; results = query.getResultList();

        return results;
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find a list of objects that satisfy a condition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Override
    public List&amp;lt;CompanyHandyPerson&amp;gt; findCompanyHandyPeopleThatAreSoftwareDevelopers() {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery&amp;lt;CompanyHandyPerson&amp;gt; criteriaQuery = criteriaBuilder.createQuery(CompanyHandyPerson.class);
        Root&amp;lt;CompanyHandyPerson&amp;gt; root = criteriaQuery.from(CompanyHandyPerson.class);

        // Check against the tradeId representing a specific one
criteriaQuery.select(root).where(criteriaBuilder.equal(root.get("tradeId"), 1L));

        Query query = entityManager.createQuery(criteriaQuery);
        List&amp;lt;CompanyHandyPerson&amp;gt; results = query.getResultList();

        return results;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find a list of objects with a LIKE condition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Override
    public List&amp;lt;Trade&amp;gt; findAllTradesWithNameSimilarTo(String tradeName) {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery&amp;lt;Trade&amp;gt; criteriaQuery = criteriaBuilder.createQuery(Trade.class);
        Root&amp;lt;Trade&amp;gt; root = criteriaQuery.from(Trade.class);
        criteriaQuery.select(root).where(criteriaBuilder.like(root.get("name"), "%" + tradeName + "%"));

// Or without taking into consideration lower or upper cases
/**
* Predicate likePredicate = *criteriaBuilder.like(criteriaBuilder.lower(pantryItemRoot.get("name")), "%" + input.toLowerCase() + "%");
        *pantryItemCriteriaQuery.select(pantryItemRoot).where(likePredicat*e);
*/

        Query query = entityManager.createQuery(criteriaQuery);
        List&amp;lt;Trade&amp;gt; results = query.getResultList();

        return results;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find a list of objects that have an Id in a given array of Ids:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Override
    public List&amp;lt;CompanyHandyPerson&amp;gt; findCompanyHandyPeopleThatHaveOneOfTheGivenTradeId(Long[] tradeIds) {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery&amp;lt;CompanyHandyPerson&amp;gt; criteriaQuery = criteriaBuilder.createQuery(CompanyHandyPerson.class);
        Root&amp;lt;CompanyHandyPerson&amp;gt; root = criteriaQuery.from(CompanyHandyPerson.class);

        // Check tradeId is part of the given tradeIds
        criteriaQuery.select(root)
                .where(root.get("tradeId")
                        .in(tradeIds));

        Query query = entityManager.createQuery(criteriaQuery);
        List&amp;lt;CompanyHandyPerson&amp;gt; results = query.getResultList();

        return results;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return a list of non-empty strings for &lt;em&gt;userFeedbackTitle&lt;/em&gt; or &lt;em&gt;userFeedbackDescription&lt;/em&gt; (coalesce expression)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: a job has &lt;code&gt;userFeedbackTitle&lt;/code&gt; and &lt;code&gt;userFeedbackDescription&lt;/code&gt;. None of these are forced to have values. Both can be null, both or only one can have values.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Override
    public List&amp;lt;String&amp;gt; findAllFeedbackThatExists() {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery&amp;lt;Job&amp;gt; criteriaQuery = criteriaBuilder.createQuery(Job.class);
        Root&amp;lt;Job&amp;gt; root = criteriaQuery.from(Job.class);

        // Check title and description and return when one of them is not null
        CriteriaBuilder.Coalesce&amp;lt;Job&amp;gt; coalesceExpression = criteriaBuilder.coalesce();
        coalesceExpression.value(root.get("userFeedbackTitle"));
    coalesceExpression.value(root.get("userFeedbackDescription"));

        criteriaQuery.select(coalesceExpression);

        Query query = entityManager.createQuery(criteriaQuery);
        List&amp;lt;String&amp;gt; results = query.getResultList();

        return results;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to remove all null values from the above example, you can do so by using a Predicate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Predicate&amp;lt;String&amp;gt; nullFilter = PojoPredicates.isValueNull();
        results.removeIf(nullFilter);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find all users that have jobs requests that have the job status- In Progress:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    @Override
    public List&amp;lt;PlatformUser&amp;gt; findUsersThatHaveJobsInProgress() {
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();

        CriteriaQuery&amp;lt;PlatformUser&amp;gt; userCriteriaQuery = criteriaBuilder.createQuery(PlatformUser.class);
        Root&amp;lt;PlatformUser&amp;gt; userRoot = userCriteriaQuery.from(PlatformUser.class);

        // Select user and job by user_id
        Subquery&amp;lt;Job&amp;gt; jobSubQuery = userCriteriaQuery.subquery(Job.class);
        Root&amp;lt;Job&amp;gt; jobRoot = jobSubQuery.from(Job.class);
        jobSubQuery.select(jobRoot).where(criteriaBuilder.equal(jobRoot.get("userId"), userRoot.get("id")));
        userCriteriaQuery.select(userRoot).where(criteriaBuilder.exists(jobSubQuery));

        TypedQuery&amp;lt;PlatformUser&amp;gt; typedQuery = entityManager.createQuery(userCriteriaQuery);
        List&amp;lt;PlatformUser&amp;gt; resultList = typedQuery.getResultList();

        return resultList;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's great so far. Next, I will think of more complex situations where CriteriaBuilder is a better choice.&lt;/p&gt;

&lt;p&gt;Here is the GitHub project demo for this: &lt;a href="https://tinyurl.com/y4guow7v"&gt;Demo Project Source Code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>java</category>
      <category>webdev</category>
    </item>
    <item>
      <title>From design to code</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Fri, 29 May 2020 15:39:18 +0000</pubDate>
      <link>https://dev.to/gabriela/from-design-to-code-3eag</link>
      <guid>https://dev.to/gabriela/from-design-to-code-3eag</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3nj6sze8iwjc0o5gwt91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3nj6sze8iwjc0o5gwt91.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wanted to learn how to transform a design/photo into a CSS and Html5 project. That was the starting point at least. Very quickly after I decided to transform them into React.js projects because I use React.js often and wanted a nice theme. Translating a photo into code has always made me uncomfortable because I couldn't do it. In OOP Java world I didn't have to.&lt;/p&gt;

&lt;p&gt;Here is the gist:&lt;br&gt;
Project 1: &lt;a href="https://blog-react-theme.netlify.app/" rel="noopener noreferrer"&gt;https://blog-react-theme.netlify.app/&lt;/a&gt;&lt;br&gt;
Code on GitHub: &lt;a href="https://github.com/gabrielaradu/blogreactheme" rel="noopener noreferrer"&gt;https://github.com/gabrielaradu/blogreactheme&lt;/a&gt; MIT Licence&lt;/p&gt;

&lt;p&gt;Lighthouse audit results:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkf83uv1fjcw5lytnl5w7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkf83uv1fjcw5lytnl5w7.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frme1es5lf3vnt6hlukp5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frme1es5lf3vnt6hlukp5.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Project 2: &lt;a href="https://story-react-theme.netlify.app/" rel="noopener noreferrer"&gt;https://story-react-theme.netlify.app/&lt;/a&gt;&lt;br&gt;
Code on GitHub: &lt;a href="https://github.com/gabrielaradu/storyreacttheme" rel="noopener noreferrer"&gt;https://github.com/gabrielaradu/storyreacttheme&lt;/a&gt; MIT Licence&lt;/p&gt;

&lt;p&gt;Lighthouse audit results:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6p2ti6wyp1f5fgcybbgw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6p2ti6wyp1f5fgcybbgw.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Facsko7ewylgu3ilctlsk.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Facsko7ewylgu3ilctlsk.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The projects are free to use, and I will try to iterate on the code with better practices on the long but without a precise schedule.&lt;/p&gt;

&lt;p&gt;Happy coding.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>Enhance your technical job opportunity description</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Wed, 29 Apr 2020 10:05:52 +0000</pubDate>
      <link>https://dev.to/gabriela/enhance-your-technical-job-opportunity-description-1m52</link>
      <guid>https://dev.to/gabriela/enhance-your-technical-job-opportunity-description-1m52</guid>
      <description>&lt;p&gt;Initially posted here: &lt;a href="https://documentingiscool.netlify.app/"&gt;https://documentingiscool.netlify.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are all experiencing a change in our daily life (choices as well) because of Covid-19 (worldwide pandemic, not-a-flu). As job seekers, some of us were caught during job searching, others were furlough or let go and need to find a new job. As companies, some are hiring now and some have frozen hiring. &lt;br&gt;
It is more important than ever now, as a company, to put more work into your job opportunity descriptions. Turn around the question "what can you do for us" from interviews, to "what can we as a company do for you". &lt;/p&gt;

&lt;p&gt;Why? Here is some motivation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's a business collaboration. Letting aside passion, you need people to work for you as much as people need jobs: for money.&lt;/li&gt;
&lt;li&gt;You can fire people if business dictates it and people can leave if their needs dictate that. (Stop blaming people for leaving, you would do the same if the table turns)&lt;/li&gt;
&lt;li&gt;You actually want diversity in your team and company. I mean, actually not just for marketing. More details of the interview process translate into more people that are reluctant to apply to actually apply. There is such a thing as an anxiety-inducing interview. It's like you go to a potential client meeting but have 0 information to prepare before.&lt;/li&gt;
&lt;li&gt;There are companies that have hundreds/thousands of applicants when a job is made public. Why? because they explain clearly what are the steps for the interview process, they add real-work-description for the job, they pitch their company because they want and need people to help them continue their business.&lt;/li&gt;
&lt;li&gt;Time is money, right? You want an appropriate pool of candidates so you don't waste your time and don't waste the candidates time. Yes, there is such a thing as wasting a candidate's time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have bundled together some examples (in no particular order) that I found by searching online and with the help from other nice people:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazee Labs:
&lt;a href="https://www.amazeelabs.com/en/careers-amazee-labs"&gt;https://www.amazeelabs.com/en/careers-amazee-labs&lt;/a&gt;
Their technical interview is found if you scroll down the page. They don't do "whiteboard" interviews by the way ;)&lt;/li&gt;
&lt;li&gt;Basecamp:
&lt;a href="https://basecamp.com/about/jobs"&gt;https://basecamp.com/about/jobs&lt;/a&gt;
They currently don't have openings, but when they did, the description was soo thorough. Not only for the interview process (technical interview) but for what technologies they use and how. For the last job opening, on the technical side, they asked that you code review together (I hope I didn't remember this wrong)&lt;/li&gt;
&lt;li&gt;Automattic:
&lt;a href="https://automattic.com/work-with-us/how-we-hire-developers/"&gt;https://automattic.com/work-with-us/how-we-hire-developers/&lt;/a&gt;
They have a separate page for jobs, but this one is for describing the technical interview. Everything you need to know as a candidate is written down.&lt;/li&gt;
&lt;li&gt;Aula:
&lt;a href="https://www.notion.so/Engineering-interviews-Aula-bce436a4230c4f0d8b19bc717232d289"&gt;https://www.notion.so/Engineering-interviews-Aula-bce436a4230c4f0d8b19bc717232d289&lt;/a&gt;
This is about async interview which is awesome. They understand a bit of psychology not only tech. Read it, it's comprehensive and clear.&lt;/li&gt;
&lt;li&gt;Doist:
&lt;a href="https://doist.com/blog/remote-job-application-advice/"&gt;https://doist.com/blog/remote-job-application-advice/&lt;/a&gt;
There is no active technical position but they have blog posts explaining how they hire.&lt;/li&gt;
&lt;li&gt;Auth0: &lt;a href="https://auth0.com/blog/how-we-hire-engineers/"&gt;https://auth0.com/blog/how-we-hire-engineers/&lt;/a&gt;
The post explains very clearly how they are hiring and after reading it, I had the impulse to check out job openings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more examples, I have started to add the companies that do the work in this Notion page: &lt;a href="https://www.notion.so/Technical-Interview-Process-Explained-Well-f52511e9a32f439a811930703210507a"&gt;https://www.notion.so/Technical-Interview-Process-Explained-Well-f52511e9a32f439a811930703210507a&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Knowing that tech interviews &lt;em&gt;can be&lt;/em&gt; very toxic and gatekeeping, I am sure that these companies that take the time and make their pitch to potential collaborators will continue to thrive, get traction and thousands of applicants.&lt;br&gt;
Feel free to add to the comments your own examples of companies that hire with a similar approach. I will do my best to add them to the Notion list page. Good news must be shared, especially during these times.&lt;/p&gt;

&lt;p&gt;By taking more time to create a meaningful job description, you show much clearer what you are looking for, and more people from the right-for-your-company category will apply. It's very important to acknowledge that not every developer thrives in the same type of interviews. Some like whiteboard questions, some definitely don't. Others like pair programming others appreciate more home tests in their own time and not 'on the spot'. I am going on a limb here, but I have doubts that anybody likes dictating code by phone.&lt;/p&gt;

&lt;p&gt;While hiring, it's logic that you get what you ask for. For instance, if you don't mention you do pair programming in the company and in the interview, you might get candidates that never worked like that and they won't pass. This entire process of hiring needs a bit of introspective on your part as well (company part), what you take for granted, what is easy for you is not easy for &lt;em&gt;everyone&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Not fitting your mould doesn't make other people less good. They are probably really good, they just don't shine in &lt;i&gt;your&lt;/i&gt; hiring process.&lt;br&gt;
So, empathy is crucial as well as &lt;del&gt;communicating&lt;/del&gt; writing your process. Remember, you work with people for people.&lt;/p&gt;

</description>
      <category>career</category>
      <category>hiring</category>
      <category>interview</category>
      <category>culture</category>
    </item>
    <item>
      <title>New Rest API Endpoint: from start to test in Java and SpringBoot</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Thu, 16 Apr 2020 10:33:57 +0000</pubDate>
      <link>https://dev.to/gabriela/new-endpoint-from-start-to-test-3n9f</link>
      <guid>https://dev.to/gabriela/new-endpoint-from-start-to-test-3n9f</guid>
      <description>&lt;p&gt;I want to detail the steps that &lt;em&gt;I try&lt;/em&gt; to take when creating a new endpoint in a backend project (Java, SpringBoot, Mockito). Definitely this is not the same all the time, but that's not the topic for this post.&lt;/p&gt;

&lt;p&gt;The task is: implement a new endpoint that retrieves all the products that exist at the moment.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create a new method in the service class that retrieves using persistence layer (no queries allowed here) all the products available&lt;/li&gt;
&lt;li&gt;create endpoint that calls the above service method and returns data&lt;/li&gt;
&lt;li&gt;create unit test for service method&lt;/li&gt;
&lt;li&gt;create integration test for the new endpoint.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is my way of testing, you can mix the points as you like.&lt;/p&gt;

&lt;p&gt;We are decoupling the persistence (VendorProductRepository) and business(VendorProductService) layers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public List&amp;lt;VendorProduct&amp;gt; findAllProducts() {
        return getVendorProductsRepository().findAll();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the actual endpoint, which has one liner in this case. It simply returns the result of the service call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/")
public ResponseEntity&amp;lt;?&amp;gt; getAllProducts() {
   return ResponseEntity.ok(vendorProductsService.findAllProducts());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This unit test describes the 'given' - 'when' - 'then'. We create a dummy object which we add to a list. The given part is when we describe(stub) what code will do when the repository is asked to return all products. The when part is when we call the service method, and the then part is when we verify the mocked service call returns the initially given list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Test
public void findAllProducts_always_returns_all_existing_products() {
        List&amp;lt;VendorProduct&amp;gt; productList = new ArrayList&amp;lt;&amp;gt;();
        productList.add(EntityHelper.convertToAbstractEntity(vendorProductDto, VendorProduct.class));
        when(repository.findAll()).thenReturn(productList);

        List&amp;lt;VendorProduct&amp;gt; foundProducts = subject.findAllProducts();

        assertNotNull(foundProducts);
        assertEquals(foundProducts.size(), productList.size());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This integration test, describes the happy path for retrieving a list of all available products. It hits the database so it's best to be made on a developer version of it. We make the Http call and check against the HttpStatus response and body.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Test
public void testGetAllProducts_shouldReturn_list_of_existing_products() {
        VendorProduct vendorProduct = new VendorProduct();
        vendorProduct.setId(1L);
        vendorProduct.setName("Mint Plants will be deleted");
        vendorProduct.setMinQuantityPerOrder(3d);
        vendorProduct.setMaxQuantityPerOrder(100d);
        vendorProduct.setQuantityType(QuantityType.ITEM.getIndex());
        List&amp;lt;VendorProduct&amp;gt; existingProducts = new ArrayList&amp;lt;&amp;gt;();
        existingProducts.add(vendorProduct);

        ResponseEntity&amp;lt;List&amp;gt; getResponse =  getRestTemplate().getForEntity(getRootUrl() + "/products/", List.class);
        assertEquals(HttpStatus.OK, getResponse.getStatusCode());
        assertEquals(existingProducts, getResponse.getBody());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is when I feel more confident that adding a new endpoint to do something will actually work. This code is actually part of my #twiliohackathon project, so the code is public here &lt;a href="https://github.com/gabrielaradu/BuyLocalServerSide"&gt;https://github.com/gabrielaradu/BuyLocalServerSide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>testing</category>
      <category>java</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Unit Testing static classes and methods in Java</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Tue, 14 Apr 2020 13:55:52 +0000</pubDate>
      <link>https://dev.to/gabriela/how-to-unit-test-static-classes-and-methods-50nd</link>
      <guid>https://dev.to/gabriela/how-to-unit-test-static-classes-and-methods-50nd</guid>
      <description>&lt;p&gt;Hello, I wanted to share a situation I found a couple of days ago, whilst working for my project for Twilio April Hackathon. I was working on the server-side project and creating endpoints for my product roadmap. What I insist on is testing my code, especially the logic. It's a habit I am actively trying to make.&lt;/p&gt;

&lt;p&gt;Let's take this service method that validates a phone number using Twilio API. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6Oo0cUWA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgd4nn5723yfncklwo0o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6Oo0cUWA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgd4nn5723yfncklwo0o.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We invoke 'fetch' method on com.twilio.rest.lookups.v1.PhoneNumber to receive an instance of PhoneNumberFetcher.class which will later get all the information on the provided phone number if it exists. Great!&lt;br&gt;
Now, how do we test this? We cannot. We cannot mock static classes. So, we need a way to 'inject' our Twilio API call into our logic and test our code as is without worrying about the response from the external API. &lt;/p&gt;

&lt;p&gt;Check the wrapper below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WYb-5g8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ea631fmsd7blbfsz7f2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WYb-5g8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ea631fmsd7blbfsz7f2z.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we can update our service method:&lt;br&gt;
*Create getter and setter for TwilioSmsApiWrapper class&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6SVEpsZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e3h0yiakueimv5k6yyku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6SVEpsZv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e3h0yiakueimv5k6yyku.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can happily create a unit test for our service method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQEYVOTO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u20uu1i5cpq4zcow7eqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQEYVOTO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u20uu1i5cpq4zcow7eqr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. Now you have decoupled you ThirdParty Logic from your service and you can unit test your logic without relying on real API calls.&lt;br&gt;
Happy coding.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>twiliohackathon</category>
      <category>testing</category>
    </item>
    <item>
      <title>Send SMS with Twilio Question</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Fri, 10 Apr 2020 15:20:06 +0000</pubDate>
      <link>https://dev.to/gabriela/send-sms-with-twilio-question-1hhk</link>
      <guid>https://dev.to/gabriela/send-sms-with-twilio-question-1hhk</guid>
      <description>&lt;p&gt;Hello, I am trying to use SMS Api to send a message to a real Romanian phone number and the request fails with this error:&lt;br&gt;
"[o-auto-1-exec-1] c.g.l.c.TwilioMessageCreator             : An exception occurred trying to send a message to +40******&lt;strong&gt;&lt;em&gt;, exception: The 'To' number +40&lt;/em&gt;&lt;/strong&gt;****** is not a valid phone number."&lt;/p&gt;

&lt;p&gt;My question is this, can I use SMS API with a Romanian phone number or not? Thanks for the answer.&lt;/p&gt;

&lt;p&gt;Update: I figured it out, I created a new project for a hackathon and I could get a phone number to play with.&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Twilio hackathon: Buy Food Locally</title>
      <dc:creator>Gabi</dc:creator>
      <pubDate>Thu, 09 Apr 2020 17:58:46 +0000</pubDate>
      <link>https://dev.to/gabriela/twilio-hackathon-buy-food-locally-g44</link>
      <guid>https://dev.to/gabriela/twilio-hackathon-buy-food-locally-g44</guid>
      <description>&lt;p&gt;[Comment]: # Buy food from local vendors. I am trying to bring more features to a situation I found locally, and add the possibility to vendors to create an account and add their products and to safely order food, with a phone number as an identifier. This is a demo project only.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I am building
&lt;/h2&gt;

&lt;p&gt;Buy food from local vendors. I am trying to bring more features to a situation I found locally, and add the possibility to vendors to create an account and add their products and to safely order food, with phone number and email as an identifier. This means: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a web application for vendors to register themselves, and for customers to order food.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://buyfoodlocallyfrontend.herokuapp.com/"&gt;https://buyfoodlocallyfrontend.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;

&lt;p&gt;Backend: &lt;a href="https://github.com/gabrielaradu/BuyLocalServerSide"&gt;https://github.com/gabrielaradu/BuyLocalServerSide&lt;/a&gt;&lt;br&gt;
Frontend: &lt;a href="https://github.com/gabrielaradu/BuyLocalFrontend"&gt;https://github.com/gabrielaradu/BuyLocalFrontend&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I built it (what's the stack? did I run into issues or discover something new along the way?)
&lt;/h2&gt;

&lt;p&gt;Backend: Java 11, SpringBoot, Flyway, Hibernate, Postgresql, Twilio APIs: ServerSide, SMS, Phone Number Validation &lt;br&gt;
JavaScript, ES6, React.js, CSS, Html&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&gt;

&lt;p&gt;Progress Gists:&lt;br&gt;
9.04.2020 -&amp;gt;&lt;br&gt;
Working on my idea for #twiliohackathon hackathon (from home clearly).&lt;br&gt;
Today: new vendor account v1. No password yet, need to update db structure in next ticket. This is the code if you want to take a look: &lt;a href="https://tinyurl.com/untyhz8"&gt;https://tinyurl.com/untyhz8&lt;/a&gt;&lt;br&gt;
Must create test profile to stop mucking my db.&lt;/p&gt;

&lt;p&gt;10.04.2020 -&amp;gt; 1.Created CRUD endpoints for products.&lt;br&gt;
PR here &lt;a href="https://tinyurl.com/uo553tu"&gt;https://tinyurl.com/uo553tu&lt;/a&gt;&lt;br&gt;
Code coverage 100%. I do wonder how long I can keep it this high.&lt;br&gt;
WIP to validate a vendor account phone nr using Twilio SDK.&lt;/p&gt;

&lt;p&gt;11.04.2020 -&amp;gt; Verify Vendor Account.&lt;br&gt;
Added possibility to verify a number, send an SMS with a code to that number and create endpoint which checks if the message code matches what is in the database.&lt;br&gt;
PR: &lt;a href="https://tinyurl.com/uy5y9a6"&gt;https://tinyurl.com/uy5y9a6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;13.04.2020 -&amp;gt; Added possibility to create a password after vendor verified their account. Working on security still.&lt;br&gt;
Difficult to concentrate today.&lt;/p&gt;

&lt;p&gt;14.04.2020 -&amp;gt; Finished adding JWT, attach a password to a vendor account and login endpoint. Fixed existing failing tests and add some more unit and integration. Two tests that use Test Twilio Creds fail.&lt;br&gt;
PR: &lt;a href="https://tinyurl.com/rl4tzah"&gt;https://tinyurl.com/rl4tzah&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Need to move to create Frontend client now.&lt;br&gt;
17.04.2020 -&amp;gt; Show list of products&lt;br&gt;
PR: &lt;a href="https://github.com/gabrielaradu/BuyLocalFrontend/pull/1"&gt;https://github.com/gabrielaradu/BuyLocalFrontend/pull/1&lt;/a&gt;&lt;br&gt;
No tests, and weird-looking UI. Need to fix this.&lt;/p&gt;

&lt;p&gt;24.04.2020 -&amp;gt;&lt;br&gt;
Finally did the user story for ordering products from two vendors.&lt;br&gt;
Step 1: add your customer phone number. That's how you will get payment link and info about order.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tj3TyzI4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8rmyylrz1tx49wsq1vwr.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tj3TyzI4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8rmyylrz1tx49wsq1vwr.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, choose what you want to buy. Dummy data (flyway migrations on backend) has two vendors.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2K9JLZR2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zch1y1kxphokksskqi17.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2K9JLZR2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zch1y1kxphokksskqi17.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vendor clicks the accept or denies order and customer will receive an automatic SMS with the final response.&lt;/p&gt;

&lt;p&gt;A confirmation dialogue will appear if all is good on the server side. By this time, vendors received SMS messages with #twilio API with the customer order.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P_vxJUX0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rf29u0vv4wqwzsncw2sj.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P_vxJUX0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rf29u0vv4wqwzsncw2sj.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HJiufmuS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7ll4q41vzz8jjy5g7rcp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HJiufmuS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7ll4q41vzz8jjy5g7rcp.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the server-side I have implemented logic to create a vendor account and verify it (by SMS of course) using #twilio API, for this demo #twiliohackathon project I think it's enough. I need to redo and add more tests now.&lt;/p&gt;

&lt;p&gt;I enjoyed this challenge a lot, reminded that I want to do better on Frontend and enjoy tests more.&lt;/p&gt;

&lt;p&gt;Happy Coding.&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
      <category>devjournal</category>
      <category>java</category>
      <category>react</category>
    </item>
  </channel>
</rss>
