Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done the task, cover all code by JUniy5 test. Try to do correct, now … #835

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AntonBabychP1T
Copy link

…have line coverage more than 90%

…have line coverage more than 90%. Fix problem with git, change some name of test
…have line coverage more than 90%. Fix problem with git, change some name of test
Copy link

@kerrrusha kerrrusha left a comment

Choose a reason for hiding this comment

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

almost good

Comment on lines +24 to +27
FruitTransaction validTransaction =
new FruitTransaction(DEFAULT_OPERATION, DEFAULT_NAME, DEFAULT_QUANTITY);
assertEquals(DEFAULT_TRANSACTION, validTransaction);
}

Choose a reason for hiding this comment

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

Suggested change
FruitTransaction validTransaction =
new FruitTransaction(DEFAULT_OPERATION, DEFAULT_NAME, DEFAULT_QUANTITY);
assertEquals(DEFAULT_TRANSACTION, validTransaction);
}
FruitTransaction actualTransaction =
new FruitTransaction(DEFAULT_OPERATION, DEFAULT_NAME, DEFAULT_QUANTITY);
assertEquals(DEFAULT_TRANSACTION, actualTransaction);
}

Comment on lines +13 to +21
private static Map<FruitTransaction.Operation, OperationHandlers> operationHandlersMap =
new HashMap<>() {
{
put(FruitTransaction.Operation.BALANCE, new BalanceTypeHandler());
}
};

private static final OperationStrategy OPERATION_STRATEGY
= new OperationStrategyImpl(operationHandlersMap);

Choose a reason for hiding this comment

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

this should be done in setUp method

Suggested change
private static Map<FruitTransaction.Operation, OperationHandlers> operationHandlersMap =
new HashMap<>() {
{
put(FruitTransaction.Operation.BALANCE, new BalanceTypeHandler());
}
};
private static final OperationStrategy OPERATION_STRATEGY
= new OperationStrategyImpl(operationHandlersMap);
private static OperationStrategy strategy;
@BeforeAll
static void setUp() {
Map<FruitTransaction.Operation, OperationHandlers> operationHandlerMap = Map.of(FruitTransaction.Operation.BALANCE, new BalanceTypeHandler());
strategy = new OperationStrategyImpl(operationHandlerMap);
}

void balanceHandleTransaction_ValidData_Ok() {
OPERATION_HANDLERS.handleTransaction(VALID_FRUIT_TRANSACTION);
assertEquals(Map.of(VALID_NAME,VALID_QUANTITY).entrySet(),storage.entrySet());

Choose a reason for hiding this comment

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

Suggested change

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