Skip to content

complete homework: annotation, reflection#34

Open
iakkov wants to merge 1 commit into
mainfrom
HW03-annotations
Open

complete homework: annotation, reflection#34
iakkov wants to merge 1 commit into
mainfrom
HW03-annotations

Conversation

@iakkov

@iakkov iakkov commented Aug 18, 2025

Copy link
Copy Markdown
Owner
  • Created 3 annotations: @test, @before, @after
  • Class MyTestClass with all three types of annotations
  • Class TestRunner, with an input String className. All private methods were separated.
  • One copy of TestRunner object for each group of three annotations.
  • Statistic

Comment thread .idea/misc.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Файлы IDE не должны попадать в репозиторий

Comment thread javaProfessional.iml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

И т.д.

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Еще @Target надо

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

И т.д.

List<Method> afterMethods = new ArrayList<>();
splitMethods(testClass, beforeMethods, testMethods, afterMethods);

int passed = 0, failed = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужен только один. Второй вычисляемый

Comment on lines +45 to +47
if (m.isAnnotationPresent(Before.class)) beforeMethods.add(m);
if (m.isAnnotationPresent(Test.class)) testMethods.add(m);
if (m.isAnnotationPresent(After.class)) afterMethods.add(m);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В Java по соглашению блок {} пишется даже для одной строки и завершается не на той строке с которой начался

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