/alchemy

Making Java Fun Again

Primary LanguageCSSApache License 2.0Apache-2.0

Alchemy Build Status Join the chat at https://gitter.im/SirWellington/alchemy Aroma Enabled

Alchemy Logo

Making Java fun again

Your kit for clean Java.

Alchemy Design

We take our inspiration from Mother Nature, specifically the four elements of nature. We call this Alchemy Design.

Earth

Alchemy is Solid and Dependable like the Earth.

assertThrows(() -> database.save(user))
    .isInstanceOf(SQLException.class);

We aim to provide you with libraries as solid and dependable as the floor beneath your feet that you implicitly trust to not collapse. This means that our code is thoroughly tested early and often.

Wind

Alchemy is Swift and Undetectable like Wind.

String randomUsername = one(alphabeticStrings());

We strive to be breezy yet inconspicuous like the air you breathe.

We believe great code helps you get the job done, without getting in the way.

Water

Alchemy is Fluid and Simple like Water.

checkThat(firstName, lastName, username)
    .are(nonEmptyString())
    .are(stringWithLengthAtLeast(1));

The best code is simple and fluid as a river flowing down a stream. It flows as you would intuitively expect.

Fire

Alchemy is Powerful and Invigorating like Fire.

We want you to feel the power as it flows through your hands when you write code with us.

Coffee myCoffee = http.go()
		      .get()
		      .expecting(Coffee.class)
		      .at("http://aroma.coffee/orders?orderNumber=99");

These Design Principles guide the code that we write. As such you will see that many of our projects use the Fluid Language Style to make writing code more expressive and much closer to English. We also want you to feel good when you write code with us. We want you to feel powerful.

Project List

Name Features
Alchemy Annotations Explicit Documentation
Alchemy Arguments Check your assumptions
Alchemy Collections Collect Yo'self
Alchemy Generator Generate Data
Alchemy Test Test your code
Alchemy HTTP Call REST Services
Alchemy HTTP Mock Test your HTTP Code

Highlights

Generate Test Data

String username = one(hexadecimalString());
int zipCode = one(integers(10_000, 99_999));
Computer computer = one(pojos(Computer.class));

Test your code

//Runs the test 50 times
@Repeat(50)
@Test
public void testDatabase()
{
    //Generate random data
    String name = one(alphabeticStrings());

    //Quickly assert error conditions
    assertThrows(() -> database.save(name))
        .isInstanceOf(SQLException.class);
}

Check your assumptions

public int getTotalPointsForUser(String user) throws HttpException
{
    checkThat(user)
        .is(notNull())
        .is(nonEmptyString())
        .is(stringWithLengthAtLeast(3))
        .is(userInDatabase()); //Custom Assertion

    //Proceed safely...
}

Call REST Services

Device newDevice = http.go()
                       .post()
                       .body(device)
                       .expecting(Device.class)
                       .at("https://iot.io/api/devices/");

Just remember, this is only the beginning. These libraries will be continuously improved and updated.

Requirements

  • Java 8
  • Maven

License

This Software, and all sub-projects, are licensed under the Apache 2.0 License

http://www.apache.org/licenses/LICENSE-2.0