Hello,
I am trying to write unit tests testing Active Objects.
Following the tutorial here https://developer.atlassian.com/server/framework/atlassian-sdk/getting-started-with-active-objects
Currently I get error:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.068 s <<< FAILURE! - in ut.org.company.EngineeringUserServiceImplTest
testCreateNewUser(ut.org.company.EngineeringUserServiceImplTest) Time elapsed: 0.019 s <<< ERROR!
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
I have added dependency:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<scope>provided</scope>
</dependency>
import com.atlassian.activeobjects.external.ActiveObjects;
import com.atlassian.activeobjects.test.TestActiveObjects;
import net.java.ao.EntityManager;
import net.java.ao.test.junit.ActiveObjectsJUnitRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.company.activeobjects.entity.EngineeringUser;
import org.company.service.EngineeringUserServiceImpl;
import static org.junit.Assert.assertNotNull;
@RunWith(ActiveObjectsJUnitRunner.class)
public class EngineeringUserServiceImplTest {
private EntityManager entityManager;
private EngineeringUserServiceImpl engineeringUserService;
private ActiveObjects ao;
@Before
public void setUp() throws Exception {
assertNotNull(entityManager);
ao = new TestActiveObjects(entityManager);
engineeringUserService = new EngineeringUserServiceImpl(ao);
}
@Test
public void testCreateNewUser() {
ao.migrate(EngineeringUser.class);
EngineeringUser newUser = engineeringUserService.createNewUser();
assertNotNull(newUser);
}
}
I tried changing guava versions, not helping.
Error is thrown by one of these lines
ao.migrate(EngineeringUser.class);
EngineeringUser newUser = engineeringUserService.createNewUser();