1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2008, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core;
11  
12  import static org.junit.Assert.fail;
13  
14  import org.junit.Test;
15  
16  public class ContextBaseTest {
17  
18    ContextBase context = new ContextBase();
19  
20    @Test
21    public void renameDefault() {
22      context.setName(CoreConstants.DEFAULT_CONTEXT_NAME);
23      context.setName("hello");
24    }
25  
26    
27    @Test
28    public void idempotentNameTest() {
29      context.setName("hello");
30      context.setName("hello");
31    }
32  
33    @Test
34    public void renameTest() {
35      context.setName("hello");
36      try {
37        context.setName("x");
38        fail("renaming is not allowed");
39      } catch (IllegalStateException ise) {
40      }
41    }
42  
43  }