Skip to content

Commit

Permalink
~ testing: use on demand static imports
Browse files Browse the repository at this point in the history
Where it was not done yet.
  • Loading branch information
BacLuc committed Feb 3, 2022
1 parent 4d25522 commit a8b435c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package ch.scs.jumpstart.movierental.solution.refactor;

import static ch.scs.jumpstart.movierental.solution.refactor.SolutionCustomerController.AddRental;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.*;
Expand All @@ -20,8 +22,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -171,9 +171,9 @@ public void return_json_invoice() {
var customer = CustomerBuilder.builder(CUSTOMER_NAME_1).withRental(MOVIE_3, 4).build();
when(customerRepository.findById(CUSTOMER_NAME_1)).thenReturn(Optional.of(customer));

MatcherAssert.assertThat(
assertThat(
controller.getJsonInvoice(CUSTOMER_NAME_1),
Matchers.is(
is(
ok(
RentalStatementBuilder.builder(CUSTOMER_NAME_1)
.withStatementMovie(MOVIE_3.getTitle(), 5f)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
package ch.scs.jumpstart.romannumerals.solution;

import static ch.scs.jumpstart.romannumerals.solution.SolutionRomanNumeralsConverter.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Test;

class SolutionRomanNumeralsConverterTest {

@Test
public void return_roman_number_for_arabic_number() {
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(0), nullValue());
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(1), is("I"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(2), is("II"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(3), is("III"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(5), is("V"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(10), is("X"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(50), is("L"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(100), is("C"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(500), is("D"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(1000), is("M"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(2687), is("MMDCLXXXVII"));
assertThat(convert(0), nullValue());
assertThat(convert(1), is("I"));
assertThat(convert(2), is("II"));
assertThat(convert(3), is("III"));
assertThat(convert(5), is("V"));
assertThat(convert(10), is("X"));
assertThat(convert(50), is("L"));
assertThat(convert(100), is("C"));
assertThat(convert(500), is("D"));
assertThat(convert(1000), is("M"));
assertThat(convert(2687), is("MMDCLXXXVII"));

MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(4), is("IV"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(9), is("IX"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(40), is("XL"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(90), is("XC"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(400), is("CD"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(900), is("CM"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(949), is("CMXLIX"));
MatcherAssert.assertThat(SolutionRomanNumeralsConverter.convert(3999), is("MMMCMXCIX"));
assertThat(convert(4), is("IV"));
assertThat(convert(9), is("IX"));
assertThat(convert(40), is("XL"));
assertThat(convert(90), is("XC"));
assertThat(convert(400), is("CD"));
assertThat(convert(900), is("CM"));
assertThat(convert(949), is("CMXLIX"));
assertThat(convert(3999), is("MMMCMXCIX"));
}
}

0 comments on commit a8b435c

Please sign in to comment.