parent
da6ee4b420
commit
505c3ca733
@ -0,0 +1,20 @@ |
|||||||
|
databaseChangeLog: |
||||||
|
- changeSet: |
||||||
|
id: 1 |
||||||
|
author: alex@bearns.me |
||||||
|
changes: |
||||||
|
- createTable: |
||||||
|
tableName: version |
||||||
|
columns: |
||||||
|
- column: |
||||||
|
name: version_id |
||||||
|
type: number |
||||||
|
constraints: |
||||||
|
primaryKey: true |
||||||
|
nullable: false |
||||||
|
- column: |
||||||
|
name: version_txt |
||||||
|
type: number |
||||||
|
- column: |
||||||
|
name: xml_url |
||||||
|
type: varchar |
@ -1,4 +1,4 @@ |
|||||||
databaseChangeLog: |
databaseChangeLog: |
||||||
- changeSet: |
- include: |
||||||
id: 1 |
- file: "000_initial_schema.yaml" |
||||||
author: alex@bearns.me |
- relativeToChangelogFile: "true" |
@ -1,13 +0,0 @@ |
|||||||
package me.bearns.fias; |
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test; |
|
||||||
import org.springframework.boot.test.context.SpringBootTest; |
|
||||||
|
|
||||||
@SpringBootTest |
|
||||||
class FiasApplicationTests { |
|
||||||
|
|
||||||
@Test |
|
||||||
void contextLoads() { |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,49 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2002-2016 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. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package me.bearns.fias; |
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat; |
||||||
|
|
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
|
import me.bearns.fias.domain.FiasVersion; |
||||||
|
import me.bearns.fias.repository.FiasVersionRepository; |
||||||
|
import org.junit.jupiter.api.Test; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; |
||||||
|
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; |
||||||
|
|
||||||
|
@DataJpaTest |
||||||
|
public class VersionRepositoryTests { |
||||||
|
@Autowired |
||||||
|
private TestEntityManager entityManager; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private FiasVersionRepository repository; |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testFindByLastName() { |
||||||
|
FiasVersion fiasVersion = new FiasVersion(1L, "last", "c", "d"); |
||||||
|
entityManager.persist(fiasVersion); |
||||||
|
|
||||||
|
Optional<FiasVersion> byId = repository.findById(fiasVersion.getVersionId()); |
||||||
|
|
||||||
|
FiasVersion version = byId.get(); |
||||||
|
|
||||||
|
assertThat(version).extracting(FiasVersion::getVersionId).isEqualTo(fiasVersion.getVersionId()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue