Skip to content

Feature/hw-03 - #3

Open
uoles wants to merge 25 commits into
masterfrom
feature/hw-03
Open

Feature/hw-03#3
uoles wants to merge 25 commits into
masterfrom
feature/hw-03

Conversation

@uoles

@uoles uoles commented Apr 22, 2019

Copy link
Copy Markdown
Owner

No description provided.

uoles and others added 23 commits March 16, 2019 10:11
- Добавление исключения QuestionsFileLoadingException.
- Работа с консолью вынесена в сервис ConsoleService.
- Тесты для QuestionsDAO.
- Добавлены тесты.
- Изменения в структуре файлов.
- Использование библиотеки lombok.
- Файл настроек.
- Java + Annotation-based конфигурация.
- Изменена работа с файлом.
- Использование @DaTa вместо @Getter, @Setter.
- Добавление своего баннера.
Comment thread pom.xml Outdated
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вах, как красиво) Но эо не обязательно добавлять со Spring Boot. Spring Boot parent содержит именно эти строчки от java.version

Comment thread pom.xml Outdated
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если Вы используете jupiter (junit5), то junit4 в идеале быть не должно (только для легаси кода)

Comment thread pom.xml
<target>${java.version}</target>
<encoding>${encoding}</encoding>
</configuration>
</plugin>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот это как раз уже есть в parent-e


@SpringBootApplication
@PropertySource("classpath:application.yml")
@EnableConfigurationProperties({LocaleProperties.class, QuetionsProperties.class})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А этотне обязательно добавлять, если Вы LocaleProperties делаете компонентом

@Data
public class Question implements Serializable {

public static final String c_id = "id";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Так, для static-final переменных название должно быть C_ID
  2. Без этой константы прекрасно можно обойтись

String answer = null;
boolean okAnswer = false;
int i = 0;
while (!okAnswer && i < 4) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аааргх, магическая константа)

Question.c_answer3,
Question.c_answer4,
Question.c_trueAnswer
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот это можно аак раз переписать)

\:\ /:/ / \:\ /:/ / \:\ \ \:\ \:\__\ \:\ \:\__\
\:\/:/ / \:\/:/ / \:\ \ \:\ \/__/ \:\/:/ /
\::/ / \::/ / \:\__\ \:\__\ \::/ /
\/__/ \/__/ \/__/ \/__/ \/__/ No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прелесть)

@DisplayName("Класс LocalisationServiceImpl")
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("ru")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот лучше проще профилями совсем ее пользоваться)

() -> assertNotNull(value),
() -> assertEquals("При и вет - Привет", value)
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А вот логику тестирования, по-хорошему, надо проверить.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants