-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error mapping enum by ordinal instead of string
- Loading branch information
1 parent
99e698c
commit 00b5d3a
Showing
8 changed files
with
98 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...oenergia/conluz/infrastructure/production/get/GetEnergyStationRepositoryDatabaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.lucoenergia.conluz.infrastructure.production.get; | ||
|
||
import org.lucoenergia.conluz.domain.admin.user.UserMother; | ||
import org.lucoenergia.conluz.domain.production.plant.Plant; | ||
import org.lucoenergia.conluz.domain.production.InverterProvider; | ||
import org.lucoenergia.conluz.domain.production.plant.PlantMother; | ||
import org.lucoenergia.conluz.infrastructure.admin.user.UserEntity; | ||
import org.lucoenergia.conluz.infrastructure.admin.user.UserRepository; | ||
import org.lucoenergia.conluz.infrastructure.production.plant.PlantEntity; | ||
import org.lucoenergia.conluz.infrastructure.production.plant.PlantRepository; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.lucoenergia.conluz.infrastructure.shared.BaseIntegrationTest; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.MockitoAnnotations; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Transactional | ||
class GetEnergyStationRepositoryDatabaseTest extends BaseIntegrationTest { | ||
|
||
@Autowired | ||
private GetEnergyStationRepositoryDatabase getEnergyStationRepositoryDatabase; | ||
@Autowired | ||
private PlantRepository plantRepository; | ||
@Autowired | ||
private UserRepository userRepository; | ||
|
||
@Test | ||
void testFindAllByInverterProvider() { | ||
UserEntity user = userRepository.save(UserMother.randomUserEntity()); | ||
PlantEntity plantEntity1 = plantRepository.save(PlantMother.randomPlantEntity().withUser(user).build()); | ||
PlantEntity plantEntity2 = plantRepository.save(PlantMother.randomPlantEntity().withUser(user).build()); | ||
|
||
List<Plant> expectedPlants = getEnergyStationRepositoryDatabase.findAllByInverterProvider(InverterProvider.HUAWEI); | ||
|
||
Assertions.assertEquals(2, expectedPlants.size()); | ||
Assertions.assertEquals(plantEntity1.getId(), expectedPlants.get(0).getId()); | ||
Assertions.assertEquals(plantEntity2.getId(), expectedPlants.get(1).getId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters