cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hybris123 Tour: Senseless integration test in Properties Files section

0 Likes
420

The integration test DefaultBandFacadeIntegrationWithPropertiesTest in the "properties files" part of the Hybris123 Tour has no meaning because it is always true:

     package concerttours.facades.impl;
     import static org.junit.Assert.assertTrue;
     import java.util.List;
     import de.hybris.bootstrap.annotations.IntegrationTest;
     import de.hybris.platform.servicelayer.ServicelayerTransactionalTest;
     import javax.annotation.Resource;
     import org.junit.Test;
     import concerttours.data.BandData;
     import concerttours.facades.BandFacade;
     
     @IntegrationTest
     public class DefaultBandFacadeIntegrationWithPropertiesTest extends ServicelayerTransactionalTest
     {
     @Resource
     private BandFacade bandFacade;
     
     @Test
     public void testProperties() throws Exception
     {
     createCoreData();
     importCsv("/impex/essentialdata-mediaformats.impex", "UTF-8");
     importCsv("/impex/concerttours-bands.impex", "utf-8");
     importCsv("/impex/concerttours-yBandTour.impex", "utf-8");
     
     List<BandData> bands = bandFacade.getBands();
     assertTrue(bands.size() > 0);
 //It's always true!
 assertTrue( DefaultBandFacade.BAND_LIST_FORMAT.equals("band.list.format.name"));
     }
     }

Can someone change it please? For test purpose, I think something similar to the following has more sense:

 package concerttours.facades.impl;
 import concerttours.data.BandData;
 import concerttours.facades.BandFacade;
 import de.hybris.bootstrap.annotations.IntegrationTest;
 import de.hybris.platform.servicelayer.ServicelayerTransactionalTest;
 import de.hybris.platform.servicelayer.config.ConfigurationService;
 import org.junit.Test;
 
 import javax.annotation.Resource;
 import java.util.List;
 
 import static org.junit.Assert.assertTrue;
 
 @IntegrationTest
 public class DefaultBandFacadeIntegrationWithPropertiesTest extends ServicelayerTransactionalTest
 {
     @Resource
     private BandFacade bandFacade;
     @Resource
     private ConfigurationService configurationService;
 
     @Test
     public void testProperties() throws Exception
     {
         createCoreData();
         importCsv("/impex/essentialdata-mediaformats.impex", "UTF-8");
         importCsv("/impex/concerttours-bands.impex", "utf-8");
         importCsv("/impex/concerttours-yBandTour.impex", "utf-8");
 
         List<BandData> bands = bandFacade.getBands();
         final String mediaFormatName = configurationService.getConfiguration().getString(DefaultBandFacade.BAND_LIST_FORMAT);
         assertTrue(bands.size() > 0);
         assertTrue("bandList".equals(mediaFormatName));
     }
 }






Accepted Solutions (0)

Answers (0)