Polishing.
Add author tags. Reduce visibility where applicable. Reformat code. See #583. Original pull request: #615.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 the original author or authors.
|
||||
* Copyright 2017-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,28 +25,27 @@ import java.util.List;
|
||||
|
||||
import org.assertj.core.groups.Tuple;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.data.jdbc.AutoConfigureDataJdbc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
|
||||
/**
|
||||
* Demonstrates various possibilities to customize the behavior of a repository.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@SpringBootTest(classes = AggregateConfiguration.class)
|
||||
@AutoConfigureDataJdbc
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
|
||||
public class AggregateTests {
|
||||
class AggregateTests {
|
||||
|
||||
@Autowired LegoSetRepository repository;
|
||||
|
||||
@Test
|
||||
public void exerciseSomewhatComplexEntity() {
|
||||
void exerciseSomewhatComplexEntity() {
|
||||
|
||||
LegoSet smallCar = createLegoSet("Small Car 01", 5, 12);
|
||||
smallCar.setManual(new Manual("Just put all the pieces together in the right order", "Jens Schauder"));
|
||||
@@ -75,7 +74,7 @@ public class AggregateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customQueries() {
|
||||
void customQueries() {
|
||||
|
||||
String smallCarsSetName = "Small Car - 01";
|
||||
LegoSet smallCars = createLegoSet(smallCarsSetName, 5, 10);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 the original author or authors.
|
||||
* Copyright 2017-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,29 +15,31 @@
|
||||
*/
|
||||
package example.springdata.jdbc.basics.simpleentity;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureJdbc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import example.springdata.jdbc.basics.Output;
|
||||
import example.springdata.jdbc.basics.aggregate.AgeGroup;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureJdbc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* Demonstrates simple CRUD operations with a simple entity without any references.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@SpringBootTest(classes = CategoryConfiguration.class)
|
||||
@AutoConfigureJdbc
|
||||
public class SimpleEntityTests {
|
||||
class SimpleEntityTests {
|
||||
|
||||
@Autowired CategoryRepository repository;
|
||||
|
||||
@Test
|
||||
public void exerciseRepositoryForSimpleEntity() {
|
||||
void exerciseRepositoryForSimpleEntity() {
|
||||
|
||||
// create some categories
|
||||
Category cars = repository.save(new Category("Cars", "Anything that has approximately 4 wheels.", AgeGroup._3to8));
|
||||
@@ -60,7 +62,7 @@ public class SimpleEntityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void directInsert(){
|
||||
void directInsert() {
|
||||
|
||||
Category cars = new Category("Cars", "Anything that has approximately 4 wheels.", AgeGroup._3to8).withId(23L);
|
||||
repository.insert(cars);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 the original author or authors.
|
||||
* Copyright 2017-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,34 +15,34 @@
|
||||
*/
|
||||
package example.springdata.jdbc.jooq;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.tuple;
|
||||
import static java.util.Arrays.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureJdbc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
|
||||
/**
|
||||
* Demonstrates simple CRUD operations with a simple entity without any references.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Florian Lüdiger
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@SpringBootTest(classes = CategoryConfiguration.class)
|
||||
@AutoConfigureJdbc
|
||||
@ComponentScan
|
||||
public class SimpleEntityTests {
|
||||
class SimpleEntityTests {
|
||||
|
||||
@Autowired CategoryRepository repository;
|
||||
|
||||
@Test
|
||||
public void exerciseRepositoryForSimpleEntity() {
|
||||
void exerciseRepositoryForSimpleEntity() {
|
||||
|
||||
// create some categories
|
||||
Category cars = new Category(null, "Cars", "Anything that has approximately 4 wheels", AgeGroup._3to8);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 the original author or authors.
|
||||
* Copyright 2020-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,28 +18,27 @@ package example.springdata.jdbc.mybatis;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mybatis.spring.boot.test.autoconfigure.MybatisTest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureJdbc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Demonstrates queries can be mapped using MyBatis.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = MyBatisConfiguration.class)
|
||||
@AutoConfigureJdbc
|
||||
@MybatisTest
|
||||
public class MyBatisTests {
|
||||
class MyBatisTests {
|
||||
|
||||
@Autowired LegoSetRepository repository;
|
||||
|
||||
@Test
|
||||
public void exerciseSomewhatComplexEntity() {
|
||||
void exerciseSomewhatComplexEntity() {
|
||||
|
||||
LegoSet smallCar = createLegoSet();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user