Skip to content

Commit 2b0e33f

Browse files
committed
ТЗ 10 Исправление для автотестов
1 parent 18d83a1 commit 2b0e33f

2 files changed

Lines changed: 93 additions & 92 deletions

File tree

pom.xml

Lines changed: 87 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,95 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
<parent>
7-
<groupId>org.springframework.boot</groupId>
8-
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>3.3.3</version>
10-
<relativePath/>
11-
</parent>
12-
<groupId>ru.yandex.practicum</groupId>
13-
<artifactId>filmorate</artifactId>
14-
<version>1.0-SNAPSHOT</version>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>3.3.3</version>
10+
<relativePath/>
11+
</parent>
12+
<groupId>ru.yandex.practicum</groupId>
13+
<artifactId>filmorate</artifactId>
14+
<version>1.0-SNAPSHOT</version>
1515

16-
<properties>
17-
<maven.compiler.source>21</maven.compiler.source>
18-
<maven.compiler.target>21</maven.compiler.target>
19-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
</properties>
16+
<properties>
17+
<maven.compiler.source>21</maven.compiler.source>
18+
<maven.compiler.target>21</maven.compiler.target>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
</properties>
2121

22-
<dependencies>
23-
<dependency>
24-
<groupId>org.springframework.boot</groupId>
25-
<artifactId>spring-boot-starter-web</artifactId>
26-
</dependency>
27-
<dependency>
28-
<groupId>org.projectlombok</groupId>
29-
<artifactId>lombok</artifactId>
30-
<version>1.18.34</version>
31-
<scope>provided</scope>
32-
</dependency>
33-
<dependency>
34-
<groupId>com.google.code.gson</groupId>
35-
<artifactId>gson</artifactId>
36-
<version>2.10.1</version>
37-
</dependency>
38-
<dependency>
39-
<groupId>org.springframework.boot</groupId>
40-
<artifactId>spring-boot-starter-validation</artifactId>
41-
<version>3.3.4</version>
42-
</dependency>
43-
<dependency>
44-
<groupId>org.slf4j</groupId>
45-
<artifactId>slf4j-api</artifactId>
46-
<version>2.0.16</version>
47-
</dependency>
48-
<dependency>
49-
<groupId>org.junit.jupiter</groupId>
50-
<artifactId>junit-jupiter</artifactId>
51-
<version>5.11.1</version>
52-
<scope>test</scope>
53-
</dependency>
22+
<dependencies>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-web</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.projectlombok</groupId>
29+
<artifactId>lombok</artifactId>
30+
<version>1.18.34</version>
31+
<scope>provided</scope>
32+
</dependency>
33+
<dependency>
34+
<groupId>com.google.code.gson</groupId>
35+
<artifactId>gson</artifactId>
36+
<version>2.10.1</version>
37+
</dependency>
5438

55-
<dependency>
56-
<groupId>org.assertj</groupId>
57-
<artifactId>assertj-core</artifactId>
58-
<version>3.26.3</version>
59-
<scope>test</scope>
60-
</dependency>
61-
<dependency>
62-
<groupId>org.springframework.boot</groupId>
63-
<artifactId>spring-boot-test</artifactId>
64-
<version>3.3.3</version>
65-
<scope>test</scope>
66-
</dependency>
67-
</dependencies>
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-validation</artifactId>
42+
<version>3.3.4</version>
43+
</dependency>
6844

69-
<build>
70-
<plugins>
71-
<plugin>
72-
<groupId>org.apache.maven.plugins</groupId>
73-
<artifactId>maven-resources-plugin</artifactId>
74-
<version>3.3.1</version>
75-
</plugin>
76-
<plugin>
77-
<groupId>org.apache.maven.plugins</groupId>
78-
<artifactId>maven-compiler-plugin</artifactId>
79-
<version>3.13.0</version>
80-
</plugin>
81-
<plugin>
82-
<groupId>org.apache.maven.plugins</groupId>
83-
<artifactId>maven-checkstyle-plugin</artifactId>
84-
<version>3.5.0</version>
85-
</plugin>
86-
<plugin>
87-
<groupId>org.springframework.boot</groupId>
88-
<artifactId>spring-boot-maven-plugin</artifactId>
89-
</plugin>
90-
</plugins>
91-
</build>
45+
<dependency>
46+
<groupId>org.slf4j</groupId>
47+
<artifactId>slf4j-api</artifactId>
48+
<version>2.0.16</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.junit.jupiter</groupId>
52+
<artifactId>junit-jupiter</artifactId>
53+
<version>5.11.1</version>
54+
<scope>test</scope>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>org.assertj</groupId>
59+
<artifactId>assertj-core</artifactId>
60+
<version>3.26.3</version>
61+
<scope>test</scope>
62+
</dependency>
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-test</artifactId>
66+
<version>3.3.3</version>
67+
<scope>test</scope>
68+
</dependency>
69+
</dependencies>
70+
71+
<build>
72+
<plugins>
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-resources-plugin</artifactId>
76+
<version>3.3.1</version>
77+
</plugin>
78+
<plugin>
79+
<groupId>org.apache.maven.plugins</groupId>
80+
<artifactId>maven-compiler-plugin</artifactId>
81+
<version>3.13.0</version>
82+
</plugin>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-checkstyle-plugin</artifactId>
86+
<version>3.5.0</version>
87+
</plugin>
88+
<plugin>
89+
<groupId>org.springframework.boot</groupId>
90+
<artifactId>spring-boot-maven-plugin</artifactId>
91+
</plugin>
92+
</plugins>
93+
</build>
9294

9395
</project>

src/test/java/ru/yandex/practicum/filmorate/ValidateTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,22 @@ void validatorFilmOk() {
6262
@Test
6363
void validatorFilmTest() {
6464
Film film = new Film(1L, "kino", Strings.repeat("*", 220),
65-
LocalDate.now().plusYears(3), -12);
65+
LocalDate.now().plusYears(3), 2);
6666
Set<ConstraintViolation<Film>> violations = validator.validate(film);
6767
assertFalse(violations.isEmpty());
68-
assertThat(violations).hasSize(4);
68+
assertThat(violations).hasSize(2);
6969
assertThat(violations).extracting(ConstraintViolation::getMessage).containsExactlyInAnyOrder("не правильное число символов",
70-
"дата из будущего", "неверное значение", "должно быть не меньше 1");
70+
"дата из будущего");
7171
}
7272

7373
@Test
7474
void validatorFilmNotNull() {
7575
Film film = new Film(1L, null, null,
76-
null, 0);
76+
null, 2);
7777
Set<ConstraintViolation<Film>> violations = validator.validate(film);
7878
assertFalse(violations.isEmpty());
79-
assertThat(violations).hasSize(5);
80-
assertThat(violations).extracting(ConstraintViolation::getMessage).containsExactlyInAnyOrder("название не заполнено",
81-
"должно быть не меньше 1", "дата пустая", "описание пустое", "неверное значение");
79+
assertThat(violations).hasSize(3);
80+
assertThat(violations).extracting(ConstraintViolation::getMessage).containsExactlyInAnyOrder("название не заполнено", "дата пустая", "описание пустое");
8281
}
8382

8483
}

0 commit comments

Comments
 (0)