@Test public void tables() { String state = TableState.ALTERABLE.name(); Long restaurantId = 1L; Long userAuthenticationId = 1L; StringBuilder sb = new StringBuilder(context).append(OrdersController.RESTAURANT_ID_TABLES_STATE); DinnerTableDto[] dinnerTables = restTemplate.getForObject(sb.toString(), DinnerTableDto[].class, restaurantId, state); Assert.assertNotNull("dinnerTables", dinnerTables); Assert.assertTrue("dinnerTables size", dinnerTables.length == 2); sb = new StringBuilder(context) .append(OrdersController.RESTAURANT_ID_USER_AUTHENTICATION_ID_TABLES_STATE); dinnerTables = restTemplate.getForObject( sb.toString(), DinnerTableDto[].class, userAuthenticationId, restaurantId, state); Assert.assertNotNull(dinnerTables); Assert.assertNotNull("dinnerTables", dinnerTables); Assert.assertTrue("dinnerTables size", dinnerTables.length == 1); state = TableState.CASHED.name(); sb = new StringBuilder(context) .append(OrdersController.RESTAURANT_ID_USER_AUTHENTICATION_ID_TABLES_STATE); dinnerTables = restTemplate.getForObject( sb.toString(), DinnerTableDto[].class, userAuthenticationId, restaurantId, state); Assert.assertNotNull(dinnerTables); Assert.assertTrue("dinnerTables size", dinnerTables.length == 0); }
@Test public void tablesView() { Long restaurantId = 1L; StringBuilder sb = new StringBuilder(context).append(OrdersController.RESTAURANT_ID_TABLES_STATE_VIEW); ResponseEntity<String> response = restTemplate.getForEntity( sb.toString(), String.class, restaurantId, TableState.ALTERABLE.name()); Assert.assertNotNull(response.getBody()); }