#java101
Explore tagged Tumblr posts
Text
Build It! A Simple Maven Build on GitHub
Adding an automated Maven build on our Java101 project for every commit in main branch(es) and pull requests to those branch(es) can be very helpful for maintaining quality. #stepByStep #maven #cicd #GitHub
💚 TIP: References Quick List GitHub: Signing Up for a New GitHub Account GitHub: Authenticating in Your Browser GitHub: Configuring your watch settings for an individual repository. GitHub: Managing GitHub Actions Settings for a Repository GitHub: Metadata Syntax for GitHub Actions (YAML) Table of Contents Table of ContentsOverviewPrerequisitesAdd A Maven Build Yaml FileTesting for Failure –…
View On WordPress
0 notes
Photo

1st.day.hi #java101 #gaming101 #gamedesign101 https://www.instagram.com/p/BnQiQi-hpax/?utm_source=ig_tumblr_share&igshid=jsfwai2as8
0 notes
Text
Unit Testing, But Faster! Making Unit Tests Run in Parallel
Running unit tests in parallel during the build is worthwhile, even in very small projects. In addition to running more quickly, it help identify race conditions in our unit tests. #maven #unittesting #stepbystep #performance
💚 TIP: References Quick List Additional Info: maven-surefire-plugin:test Example Code With the current java101 project, we have such a small Maven build, that it runs in under 4 seconds. Why should we care about speeding it up? Unit tests added in the future may accidentally introduce race conditions (situations when two or more pieces of code are all trying to read/write to the same…
View On WordPress
0 notes
Text
Adding ints! This Time With Exceptions!
Overloading the add method for int inputs will require some exception handling. Let's use test-driven-development to overload the add method once again. #java #tdd #exceptions #stepbystep #java101
💚 TIP: References Quick List Java: Generic Methods Java: Exception Java: IllegalArgumentException Java: Integer Java: Lambda Expressions Java: Object Java: RuntimeException Java: Throwable JUnit 5: Assertions JUnit 5: Executable Example Code Let’s overload our add method again for the int data type. However, this time, when Java does the addition, it’s still going to return an int. Therefore,…
View On WordPress
0 notes
Text
You are Exceptional! Error handling in Java
In Java, when the application runs into a situation that it cannot handle, it stops processing that request and instead throws an object that indicates something went wrong. #Java #Java101 #coding #ErrorHandling #ExceptionHandling
In Java, when the application runs into a situation that it cannot handle, it stops processing that request and instead throws an object that indicates something went wrong. This can be any child of java.lang.Throwable. Unchecked Exceptions There are children of java.lang.Throwable that are not typically ones that an application will be able to recover from – and therefore should just stop…
View On WordPress
0 notes
Text
Adding Shorts, Too! - Whoa, that's Overloading!
In Java, if we define the same method name with different input parameters in the same class, Java will pick the correct one. This is called overloading. Let's create an add method to add two shorts, too. #tdd #java #java101 #unittesting #stepbystep
💚 TIP: References Quick List Additional Info: Java: Primitive Data Types JUnit 5: CsvSource Example Code There are several different types of integer values, what if we need to add those, too? All we have to do is change the input parameter types and Java will pick the correct one, even though they’re both defined as methods in the same class. This is called overloading. Let’s create an…
View On WordPress
0 notes
Text
Byte Adding - To Wrap or Not To Wrap?
Now that we understand byte over/underflow wrapping in Java, let's fix the TODOs from our prior post and make it return the desired value. #tdd #java #java101 #unittesting #stepbystep
Is there an easy way to ensure that we don’t have the over/under flow wrapping errors we saw in the last post? Yep. We are only adding 2 bytes, which together have: Minimum value of -128 + -128 = -256 Maximum value of 127 + 127 = 254 The int value that Java wanted to return before we added explicit casting in the last post is well beyond the possible range of values we might return in our…
View On WordPress
0 notes
Text
Primitive Bytes - Lets Add!
With Java primitives, Java stores the raw values. Let's look at how Java handles integer values (bytes) and what happens when they are too large or small to fit in the allowed space. #tdd #java #java101 #unittesting
Let’s look at a few of the primitive (simple, raw values that you can use in variables without constructing an object to house them) types that Java supports. The integer-based (no decimal point value) primitive Java types are: Primitive TypeMinimum Value(Inclusive)Maximum Value(Inclusive)byte-128127short-32,76821,737int-2^312^31 – 1long-2^632^63 – 1 💚 TIP: References Quick List Additional…
View On WordPress
1 note
·
View note