BAEL-137 Intro do JHipster (#1427)
* refactor: Reorder tests without lambda Moves inner implementations of Answer and ArgumentMatcher to the top of the test classes. Also changes the lambda expression to a regular "pre java 8" expression in one of the tests. Resolves: BAEL-632 * feat: Create basic Monolithic JHipster project Commit just after creating a JHipster project, before making any modifications. Resolves: BAEL-137 * chore: Change the artifactId and name of the project From baeldung to jhipster-monolithic and JHipster Monolithic Application Relates to: BAEL-137 * feat: Create entities Post and Comment Relates to: BAEL-137 * feat: Fix Gatling configuration in pom.xml Relates to: BAEL-137 * feat: Add files for Continuous Integration Relates to: BAEL-137 * feat: Change pom.xml to conform to Baeldung standards - moved the <properties> element to the bottom of the file - excluded integration tests in the default surefire configuration - added a new profile, called integration, and added the integration tests there - added Java 8 in the <source> and <target> tags, under maven-compiler solves: BAEL-137 * chore: Add jhipster module to parent pom
This commit is contained in:
+10
-10
@@ -13,6 +13,16 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
public class ArgumentMatcherWithoutLambdaUnitTest {
|
||||
|
||||
private class PeterArgumentMatcher implements ArgumentMatcher<Person> {
|
||||
|
||||
@Override
|
||||
public boolean matches(Person p) {
|
||||
return p
|
||||
.getName()
|
||||
.equals("Peter");
|
||||
}
|
||||
}
|
||||
|
||||
@InjectMocks
|
||||
private UnemploymentServiceImpl unemploymentService;
|
||||
|
||||
@@ -34,16 +44,6 @@ public class ArgumentMatcherWithoutLambdaUnitTest {
|
||||
assertFalse(unemploymentService.personIsEntitledToUnemploymentSupport(peter));
|
||||
}
|
||||
|
||||
private class PeterArgumentMatcher implements ArgumentMatcher<Person> {
|
||||
|
||||
@Override
|
||||
public boolean matches(Person p) {
|
||||
return p
|
||||
.getName()
|
||||
.equals("Peter");
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
+14
-11
@@ -17,7 +17,21 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
public class CustomAnswerWithoutLambdaUnitTest {
|
||||
|
||||
private class PersonAnswer implements Answer<Stream<JobPosition>> {
|
||||
|
||||
@Override
|
||||
public Stream<JobPosition> answer(InvocationOnMock invocation) throws Throwable {
|
||||
Person person = invocation.getArgument(0);
|
||||
|
||||
if(person.getName().equals("Peter")) {
|
||||
return Stream.<JobPosition>builder().add(new JobPosition("Teacher")).build();
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@InjectMocks
|
||||
private UnemploymentServiceImpl unemploymentService;
|
||||
|
||||
@@ -37,17 +51,6 @@ public class CustomAnswerWithoutLambdaUnitTest {
|
||||
|
||||
assertFalse(unemploymentService.searchJob(linda, "").isPresent());
|
||||
}
|
||||
|
||||
private class PersonAnswer implements Answer<Stream<JobPosition>> {
|
||||
|
||||
@Override
|
||||
public Stream<JobPosition> answer(InvocationOnMock invocation) throws Throwable {
|
||||
Person person = invocation.getArgument(0);
|
||||
|
||||
return Stream.of(new JobPosition("Teacher"))
|
||||
.filter(p -> person.getName().equals("Peter"));
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
|
||||
Reference in New Issue
Block a user