...

/

Develop the Business Service Tier

Develop the Business Service Tier

Let's see how the business service can be developed for a one-to-one unidirectional relationship scenario.

We will begin working with the business service tier, seeing as the data access tier has been developed and is ready for integration.

“Find all records” operation

First, let’s look at the test for the find all records operation. Since this is the first function being tested, the other operations are still not developed and only the find all records operation can be tested with zero records returned when the table is empty.

Press + to interact
@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath:context.xml" } )
@TransactionConfiguration( defaultRollback = true )
@Transactional
public class BookServiceImplTest {
@Autowired
private BookService service ;
@Test
public void testFindAll() {
Assert.assertEquals(0L, service.findAll().size());
}
}

Look at how to code the matching method in the business service. The data access tier uses entities, and the business service tier uses data ...