}
@Test
public void canObtainInverseMetadataForBiDirectionalManyToMany() {
// obtain inverse collection from the main side
OgmEntityPersister entityPersister = (OgmEntityPersister) sessions.getEntityPersister( AccountOwner.class.getName() );
AssociationKeyMetadata inverseAssociationKeyMetadata = BiDirectionalAssociationHelper.getInverseAssociationKeyMetadata( entityPersister, entityPersister.getPropertyIndex( "bankAccounts" ) );
assertThat( inverseAssociationKeyMetadata ).isNotNull();
assertThat( inverseAssociationKeyMetadata.getTable() ).isEqualTo( "AccountOwner_BankAccount" );
assertThat( inverseAssociationKeyMetadata.getColumnNames() ).isEqualTo( new String[]{ "bankAccounts_id" } );
assertThat( inverseAssociationKeyMetadata.getRowKeyColumnNames() ).isEqualTo( new String[]{ "bankAccounts_id", "owners_id" } );
// obtain main side collection from the inverse side
entityPersister = (OgmEntityPersister) sessions.getEntityPersister( BankAccount.class.getName() );
AssociationKeyMetadata mainSideAssociationKeyMetadata = BiDirectionalAssociationHelper.getInverseAssociationKeyMetadata( entityPersister, entityPersister.getPropertyIndex( "owners" ) );
assertThat( mainSideAssociationKeyMetadata ).isNotNull();
assertThat( mainSideAssociationKeyMetadata.getTable() ).isEqualTo( "AccountOwner_BankAccount" );
assertThat( mainSideAssociationKeyMetadata.getColumnNames() ).isEqualTo( new String[]{ "owners_id" } );
assertThat( mainSideAssociationKeyMetadata.getRowKeyColumnNames() ).isEqualTo( new String[]{ "owners_id", "bankAccounts_id" } );
}